Comments (9)
agreed, that would be better. Would you mind checking something for me? Can you try putting this line before the code where you are writing out your OBJ, and see if it works? If it does, I will push/pop this state internally inside StandardMeshWriter, but I'm not sure how to test it on my local machine (ie my culture is dot)
System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
from geometry3sharp.
That is exactly how I currently hack this issue so I confirm it works.
from geometry3sharp.
OK, I added this. StandardMeshReader and StandardMeshWriter internally push/pop the current culture. Can be disabled via flags.
If you do get around to checking that this works, would be appreciated if you let me know. Thanks for reporting!
from geometry3sharp.
I haven't had the time yet to test it but I wonder why you're changing the current culture and not use the IFormatProvider
argument for string conversions instead (e.g. .ToString(CultureInfo.InvariantCulture)
). The latter is generally the preferred way.
from geometry3sharp.
This bug affects debugging as well. As you can see it makes reading the values pretty difficult.
from geometry3sharp.
yes, that does seem irritating.
As to our first question, I agree that is the preferred way, it's right in theory...but I am a realist. It is almost certain that at some point in the future I or another developer would forget to add the culture flag to some string. Doing it at the thread level for the exporter is safer.
your second problem...I'm not sure what to do about. To handle it I have to pass in InvariantCulture all over the place, and this is not necessarily something that every user will always want. All I can think of is adding a global static field for the entire library...
from geometry3sharp.
Not to be witty or anything but can you give some examples of cases in which users would want this library to use a culture different from InvariantCulture
? I can't think of any, the library doesn't do any UI as far as I know.
I agree that sooner or later someone will forget the culture specification but you could consider adding an automated StyleCop rule for that.
from geometry3sharp.
It is entirely possible that someone will want to use this library to generate text files containing coordinates that will need to be read into some other software that expects numbers to be formatted in a specific culture.
One example I have personally dealt with is to work around bugs - for example if the reading software doesn't handle this properly, you might need to generate an OBJ with comma decimal separators so that it's text-reader parses them properly. We made this mistake w/ meshmixer, it would work fine as long as you only read back in files generated in the same culture. But english files opened w/ german meshmixer would go all blocky.
from geometry3sharp.
That sounds like a very solid reason. Defaulting to invariant culture with an option to override it (which I think is a common approach) sounds like the right way to go.
from geometry3sharp.
Related Issues (20)
- Convert mesh regions to 2d, alter in 2d, push back into 3d mesh
- Is this project dead? HOT 1
- Get brick materials right
- Fix hover info on bricks
- Rewrite right pointer (PLEASE!) HOT 1
- Mesh expansion and comparison
- Refactor cursor3d
- Refactor HandR and HandL to use input action class
- Write playmode tests for right pointer flow
- Rider clean project to adjust line length
- Break up LDrawConfig into different classes
- Refactor BrickMaterialsLoader (PLEASE!!!)
- Example of mesh volume calculation HOT 3
- 这个可以做曲面拟合吗?
- Can this be used for surface fitting?
- Narrow band SDF generation from meshes is adding a shell to objects HOT 1
- Minkowski sum 3D
- Get closest vertex on mesh surface HOT 2
- Boolean operations on polygons and polyhedra?
- Quadratic Bezier Curves HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geometry3sharp.