I am using opennurbs to write 3dm files to transfer geometry between applications. To that end, I am trying to transfer a trimmed surface by creating a brep. To help develop a procedure I have referred to example_brep.cpp, cmdSampleTwistedCube.cpp, cmdSampleTrimmedPlane.cpp, cmdSampleFaceWithHole.cpp, and Brep Data Structure with C/C++.
My interpretation is that brep edge and trim curves are just two different representations of the same curves (edges being the 3d space representation, and trim curves being the 2d surface parameter space representation). However, this would mean there is redundancy in the brep structure, and it would difficult to have them exactly equal (for example, the RhinoSDK ON_Surface Pullback and Pushup functions can only convert between 3d and 2d representations to within a tolerance), which makes me suspect I have misinterpreted trim and edge curves. Can you please correct my understanding?
I need to understand this as in my application I have a surface and 3d edge curves, but not edges defined in 2d surface parameter space. In the example code the procedure for creating a brep seems to be:
- Create vertices
- Create 3d edge curves
- Create faces
- Create loops
- Create 2d trim curves
The brep NewTrim() function used in the final step takes both a 3d edge curve and trim curve index as arguments, yet the example code appears to create the trim curve prior in a way such that either it is relying on the geometry in the example for the edge and trim to be equivalent, or it needn’t be equivalent to the edge curve at all, or perhaps the trim curve is just created to have an object that the NewTrim() function then sets appropriately to match the edge curve in 2d space. Clearly I am confused.
As a final question, Brep Data Structure with C/C++ shows the brep structure with four edge/trim curves in each loop. Is it limited to four? I suspect not as it does not explicitly state this, but another library I use, the Sintef GoTools library, does limit the boundary to four curves, which may be a coincidence, but want to be sure.