RE: General Algorithm for Primitive Calculation?
2016-08-11, 4:15 (This post was last modified: 2016-08-11, 4:16 by Travis Cobbs.)
2016-08-11, 4:15 (This post was last modified: 2016-08-11, 4:16 by Travis Cobbs.)
LDView is open source, and has primitive substitution for most LDraw primitives. Of course, it's in C++, and since it is using the values in-memory, it never rounds them, but it should be trivial to round to 4 decimal places (or whatever) during final output to the file. (You don't want to round anything except the final points written the file.)
The actual code in LDView is spread over a bunch of add... member functions in TREModel.cpp. Search for the following functions:
The actual code in LDView is spread over a bunch of add... member functions in TREModel.cpp. Search for the following functions:
- addSlopedCylinder
- addSlopedCylinder2
- addCylinder
- addChrd
- addDisc
- addNotDisc
- addCone
- addTorusIO
- addTorusIOConditionals
- addEighthSphere
- addEighthSphereConditionals
- addOpenCone
- addOpenConeConditionals
- addSlopedCylinder2Conditionals
- addCircularEdge
- addRing