1
$\begingroup$

I am using Arc3D to draw arcs that represent angles (θ & ɸ) in a 3D technical drawing.

enter image description here

Each is further delineated by the translucent triangles bounding the angle. I'd prefer to confine the translucency to a region bound by the arc and the corner inside the arc. This corner point is the m attribute in the following code.

{a, b, m} = {{1, 0, 0}, {-1, 1, 2}, {1, 1, 1}};

Arc3D[{a_, b_, m_}, n_ : 60, prim_ : Line] := 
 Module[{\[Alpha], lab, axis, aarc, tm, alpha}, 
  lab = m + Norm[a - m]*Normalize[b - m];
  axis = (a - m)\[Cross](b - m);
  aarc = (VectorAngle[a - m, b - m]);
  tm = RotationMatrix[alpha, axis];
  prim@Table[m + tm . (a - m), {alpha, 0, aarc, aarc/n}]]

Arc3DPolygon[{a_, b_, m_}, n_ : 60, prim_ : Polygon] :=
 Module[
  {\[Alpha], lab, axis, aarc, tm, alpha},
  lab = m + Norm[a - m]*Normalize[b - m];
  axis = (a - m)\[Cross](b - m);
  aarc = (VectorAngle[a - m, b - m]);
  tm = RotationMatrix[alpha, axis];
  prim@Table[
    m + tm . (a - m),
    {alpha, 0, aarc, aarc/n}
    ]
  ]

arc = Graphics3D[{
    Arc3D[{a, b, m}, 20]
    }];
arcFilled = Graphics3D[{
    Point[m], Opacity[.4], Arc3DPolygon[{a, b, m}, 20]
    }];
GraphicsGrid[{{arc, arcFilled}}]

As seen, Arc3DPolygon hacks the original Arc3D module to replace the Line with a Polygon, producing this effect.

enter image description here

How should the Arc3DPolygon module be changed to allow the addition of the m point (on the upper right in the 2nd graphic), to form the region required? Or, more generally, how should this problem be approached?

$\endgroup$
2
  • 1
    $\begingroup$ Tha basic idea would be Append[Table[..], point], though you may have to use Insert[] if Table[] does something really weird. $\endgroup$
    – Michael E2
    Commented Sep 4 at 10:52
  • $\begingroup$ Thanks @MichaelE2, that worked a treat! The implementation is below: mathematica.stackexchange.com/a/306698/100987 $\endgroup$ Commented Sep 4 at 11:48

1 Answer 1

1
$\begingroup$

This comment contained the solution. Namely to Append[Table[..], point]

Here is the implementation of Arc3DFilled:

{a, b, m} = {{1, 0, 0}, {-1, 1, 2}, {1, 1, 1}};

Arc3D[{a_, b_, m_}, n_ : 60, prim_ : Line] := 
 Module[{\[Alpha], lab, axis, aarc, tm, alpha}, 
  lab = m + Norm[a - m]*Normalize[b - m];
  axis = (a - m)\[Cross](b - m);
  aarc = (VectorAngle[a - m, b - m]);
  tm = RotationMatrix[alpha, axis];
  prim@Table[m + tm . (a - m), {alpha, 0, aarc, aarc/n}]]

Arc3DFilled[{a_, b_, m_}, n_ : 60, prim_ : Polygon] :=
 Module[
  {\[Alpha], lab, axis, aarc, tm, alpha},
  lab = m + Norm[a - m]*Normalize[b - m];
  axis = (a - m)\[Cross](b - m);
  aarc = (VectorAngle[a - m, b - m]);
  tm = RotationMatrix[alpha, axis];
  prim@Append[Table[
     m + tm . (a - m),
     {alpha, 0, aarc, aarc/n}
     ], m]
  ]

arc = Graphics3D[{
    Point[m],
    Arc3D[{a, b, m}, 20]
    }];
arcFilled = Graphics3D[{
    Opacity[.4],
    Arc3DFilled[{a, b, m}, 20]
    }];
GraphicsGrid[{{arc, arcFilled}}]

The result:

Arc3D & Arc3DFilled

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.