What determine plane orientation in perpendicular frame

trying to understand what defined the x, y orientation of a plane on the function “perpendicular frame”, since the plane i got for the ellipse or rectangular seems different in x, y direction. any factor in initial construction of the curve will affect the orientation? How to unify plane orientation?


Q_Perpendicular Frame_Plane Direction.gh (5.1 KB)

You can align the plane using align by vector component, and there are other methods too under the plane tab. Or as usual, using cross products.

The orientation is dependent on curvature, so yes different curves will produce different planes.
Check the opennurbs curve source code.


bool ON_Curve::FrameAt( double t, ON_Plane& plane) const
{
  bool rc = false;
  ON_Interval domain = Domain();
  if( t < domain[0] - ON_EPSILON || t > domain[1] + ON_EPSILON)
    return false;

  ON_3dPoint pt;
  ON_3dVector d1, d2;
  rc = Ev2Der( t, pt, d1, d2 );
  if (rc)
  {
    ON_3dVector T, K;
    rc = ON_EvCurvature(d1, d2, T, K);
    if (rc)
    {
      if (!K.Unitize())
      {
        K.PerpendicularTo(T);
        K.Unitize();
      }
      plane.origin = pt;
      plane.xaxis = T;
      plane.yaxis = K;
      plane.zaxis = ON_CrossProduct(plane.xaxis, plane.yaxis);
      if (!plane.zaxis.Unitize())
        return false;
      plane.UpdateEquation();
      rc = plane.IsValid();
      if (!rc)
      {
        //26 Aug 2015 - Chuck - If K is extremely short, but can still be unitized, the result may not be perpendicular to T.
        plane.yaxis = ON_CrossProduct(plane.zaxis, plane.xaxis);
        plane.yaxis.Unitize();
        rc = plane.UpdateEquation();
      }
    }
  }
  return rc;
}
1 Like