Update TorusGeometry with thetaStart and thetaLength#32760
Conversation
This commit adds support for specifying a thetaStart and thetaLength in TorusGeometry to allow a specified "sweep" of the tube or "semi torus"
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
corrected formatting
update formatting
re added comments and original formatting to changes
|
Tested the PR locally and it works as expected. Do you mind making the new parameters configurable in the geomtry browser? It's this code block: If you do that, users can play with the parameters in the doc page: https://threejs.org/docs/#TorusGeometry @mrdoob @WestLangley Do you support these new parameters? |
|
Yes I certainly can, I'll do this now, would you like me to update the docs with these parameters my side also? On an extended note I've also configured code that creates an "internalWall" which is run when a boolean constructor parameter "internalWall" is set to true and "thetaLength" is less than Math.PI * 2 ( creating a solid ring type shape), however I have omitted this for the time being to keep things simple and for a few other reasons as follows...
|
The parameters are difficult to both name and describe, and should probably be more akin to those of But that requires an API change for something that has had no demand. Perhaps leave the code as-is, and the OP can create a generalized version, and share it online as an add-on? |
Updated Docs & Geometry Browser to include the "thetaStart" and "ThetaLength" of TorusGeometry
revert changes to Docs as they are auto generated
@Mugen87 I have included these parameters in the geometry browser of this PR for testing as requested.
@WestLangley I agree with this, I also had difficulty finding the correct definitions of the parameters here, for example... creating the shapes in the following images by setting the "thetaStart" to Math.PI / 4 is more like the "twist" parameter for Torus Geometry in Maya...
whereas the technical terminology for the dimension being manipulated on the torus here is mathematically referred to as the "Poloidal direction" or in this case would be the "poloidal angle" ("poloidal start" and "poloidal length") which again would be Inconsistent with the naming used for SphereGeometry, CylinderGeometry and the likes...
I'm OK to close this PR if the consensus is that it's not useful, I needed to expose these parameters for a personal project but also thought it may help follow suit with the parameters of other geometries such as SphereGeometry and CylinderGeometry, let me know what's best and I'll proceed as advised. |
Updating the JSDoc is sufficient. And you have already done that. |
|
I like the improvement but my ADHD brain is annoyed with the order of parameters 😅 ( radius, tube, radialSegments, tubularSegments, arc, thetaStart, thetaLength )Guess there isn't much we can do.... |
|
We have discussed in the past more than once if enhancements of geometry generators are okay since they already have a certain complexity. I still like the policy that these modules should focus on the most important use cases since it's not complicated to create a custom generator for more specific requirements. But to me, this particular enhancement looks appropriate so I vote for a merge. |
|
BTW: The CI fails since the geometry browser has been updated and the respective file is in the "protected" We could update |



Fixed #32759
TorusGeometry does not currently support thetaStart and thetaLength properties to allow the creation of a "semi torus" such that the torus is "sliced" horizontally in half like a bagel.
This commit adds support for specifying a thetaStart and thetaLength in TorusGeometry to allow a specified "sweep" of the tube or "semi torus".