gradientspace / geometry3Sharp

C# library for 2D/3D geometric computation, mesh algorithms, and so on. Boost license.
http://www.gradientspace.com
Boost Software License 1.0
1.71k stars 384 forks source link

Is there a way to transform a BoundedImplicitFunction3d object #146

Open Justin801227 opened 4 years ago

Justin801227 commented 4 years ago

Hi everyone

I have a question, is there a way to transform a BoundedImplicitFunction3d object? Because I want to union over 10 mesh together, and I think use implicit model will be more stable. In fact, that is true, but it take too much time. And time spend in the convert mesh to implicit model is much than other process.

Because I use the same model to union only difference is coordinate. So I think if I can create only one implicit model then I can transform and copy it, it might be save a lot of time. So problem is I can not find a way to do it. Have any suggestion?

Best regards

rms80 commented 4 years ago

To do this you would have to implement a new BoundedImplicitFunction3d subclass, one that has a BoundedImplicitFunction3d child (that's the implicit you want to transform) and a Frame or Transform. Basically in the Value() function, you apply the inverse-transform to the input point and pass that point to the child's Value(). You want the inverse-transform because you are "mapping back" from the "world" 3D space to the "local space" of the child BoundedImplicitFunction3d.

You could use TransformSequence to store the transform. It's a bit expensive though, if you just want to translate or rotate you could use a Frame3f.

Doing the Bounds() is slightly trickier, you have to transform the 8 corners of the child bounds and create a new bounding-box for them. You might want to precompute this.