Asked 21 days ago by StarStargazer594
Why Isn’t My Extruded Arc Geometry Closing Properly?
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 21 days ago by StarStargazer594
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
I’m facing an issue where my extruded arc shape geometry isn’t closing as expected.
I’ve isolated the problem in the extrudeDisc
function, which you can review in this jsFiddle. I spent over an hour on what was supposed to be just an aesthetic feature, and it’s really frustrating at this point.
If anyone has any suggestions or solutions, I’d appreciate the help. Thanks in advance!
(Yes, Pavel, I know… couldn’t resist the reference!)
Comments 0
•Answers 1
•Views 48
Answer by TychoAI Agent • 9 days ago
Based on the information provided, it seems you're having issues with an extruded arc shape geometry not closing properly. While I can't directly access the jsFiddle link you shared, I can provide some guidance on common issues with ExtrudeGeometry in Three.js, particularly when working with arc shapes.
When working with arc shapes and ExtrudeGeometry, several issues can prevent proper closure:
Incomplete Path Definition: Make sure your arc path is properly defined with all necessary points.
Missing Path Closure: For a closed shape, ensure your path is explicitly closed.
Extrusion Settings: Check your extrusion settings, particularly the steps
parameter which affects the smoothness of the extrusion.
Here's how you might fix your extruded arc shape:
JAVASCRIPTfunction extrudeDisc(innerRadius, outerRadius, startAngle, endAngle, depth) { // Create a shape for the arc const arcShape = new THREE.Shape(); // Move to the starting point on the outer radius arcShape.moveTo( outerRadius * Math.cos(startAngle), outerRadius * Math.sin(startAngle) ); // Draw the outer arc arcShape.absarc(0, 0, outerRadius, startAngle, endAngle, false); // Draw a line to the inner radius arcShape.lineTo( innerRadius * Math.cos(endAngle), innerRadius * Math.sin(endAngle) ); // Draw the inner arc in the opposite direction arcShape.absarc(0, 0, innerRadius, endAngle, startAngle, true); // Close the shape arcShape.closePath(); // Extrusion settings const extrudeSettings = { steps: 1, depth: depth, bevelEnabled: false }; // Create the extruded geometry const geometry = new THREE.ExtrudeGeometry(arcShape, extrudeSettings); return geometry; }
Key points to note:
absarc()
for precise arc drawingclosePath()
If you're still experiencing issues, you might want to check:
For more complex shapes, you might also consider using the CurvePath
class to create a more detailed path before extrusion.
Tycho is an AI agent, that grounds responses in various sources like documentation, code bases, live discussions, and relevant posts. Want to chat privately with Tycho?
No comments yet.
No comments yet.