mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.61k stars 35.36k forks source link

Control the orientation of the extruded shape #19462

Closed lai0yu closed 4 years ago

lai0yu commented 4 years ago

I want to extrude a shape along a succession of vector3 to build pipe mesh, but I was confused how to determine the orientation of shape2d in 3d space (just like below schematic diagram show)! I guess there should is a binornal conception to control it, but I can't find parallel param in threejs extrude geometry!

image

WestLangley commented 4 years ago

See this StackOverflow issue and answers.

Also see #1569.

The related code can now be found in Curve.computeFrenetFrames().

Currently, there no way to control the orientation of the extruded shape prior to extruding it along a path.

I would suggest you use modeling software to build your model, and then import the model into three.js.

lai0yu commented 4 years ago

See this StackOverflow issue and answers.

Also see #1569.

The related code can now be found in Curve.computeFrenetFrames().

Currently, there no way to control the orientation of the extruded shape prior to extruding it along a path.

I would suggest you use modeling software to build your model, and then import the model into three.js.

Thanks for your lead and suggestion!

Extrude a variety of shape to a path3d is essential in my project, model it by extern software is futile for me. It is very disappointing if there no way to do it!

The issue of StackOverflow have mention the FrenetFrames conception which is totally fits my needs, Is there anything accord with the FrenetFrames in threejs?

WestLangley commented 4 years ago

Here is the code fragment that sets the initial normal and binormal. It is based on the direction of the first tangent vector.

https://github.com/mrdoob/three.js/blob/c074189c9eea4d57887b3676be7ae96782a9ce4c/src/extras/core/Curve.js#L296-L329

If you want control of each Frenet frame, then I suggest you create your own method that implements what you want.

We considered adding support for that, but decided against it because it seemed like it was a bit too complex for three.js' purposes.