Serious trigonometry problem, who can solve it !?

Hello, I’m dealing with a serious trigonometry problem. I want to model pipe elbows at 90 and 45 degrees, but I can only get it to work for 90 degrees regardless of the elbow radius. However, at 45 degrees, I encounter an issue because the sleeves are not properly positioned. I’ve created explanatory diagrams and a CodePen for you to assist me.
link here :

Here is how I determined the positions :
Frame 1

Frame 2
Frame 3

I think it’s due to the rotation.z that I apply to the fitting [topMuff.rotation.z = orientation], but I’m not sure.

Frame 4

bat signal: @PavelBoytchev :smiley:


  topMuff.position.x = radius* Math.cos(orientation);
  topMuff.position.y = radius* Math.sin(orientation);
  topMuff.position.x += (muffTransitionHeight + muffHeight/2) * -Math.sin(orientation);
  topMuff.position.y += (muffTransitionHeight + muffHeight/2) *  Math.cos(orientation);
  topMuff.rotation.z = orientation

  topTransitionMuff.position.x = radius* Math.cos(orientation);
  topTransitionMuff.position.y = radius* Math.sin(orientation);
  topTransitionMuff.position.x += muffHeight/2  * -Math.sin(orientation);
  topTransitionMuff.position.y += muffHeight/2  *  Math.cos(orientation);
  topTransitionMuff.rotation.z = orientation



you are my savior, thank you very much!!

1 Like