java.lang.Object
gov.nih.mipav.view.renderer.J3D.surfaceview.brainflattenerview.MjPrimitive

public class MjPrimitive extends Object
DOCUMENT ME!
  • Constructor Details

    • MjPrimitive

      public MjPrimitive()
  • Method Details

    • findIntersection

      public static int findIntersection(MjPrimitive.Ray2f kRay, MjPrimitive.Segment2f kSegment, float[] afT)
      The return quantity is 0 if the objects do not intersect, or is 1 or 2 if they do intersect. If 2, then the returned values are the end points of an interval of intersection. If an intersection occurs, the returned values are the parameter values for the point(s) of intersection with respect to the first object parameterized by P+t*D (t in [-inf,+inf] for line, t in [0,+inf] for ray, t in [0,1] for segment). The t parameter for the points of intersection are returned in the afT array which must have length 2.
      Parameters:
      kRay - DOCUMENT ME!
      kSegment - DOCUMENT ME!
      afT - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • findIntersection

      public static int findIntersection(MjPrimitive.Segment2f kSegment, MjPrimitive.Circle2f kCircle, javax.vecmath.Point2f[] akPoint)
      The value is 0 if the objects do not intersect. Otherwise, the quantity is 1 or 2 and is the number of valid points in The points of intersection are returned in the akPoint array which must have length 2.
      Parameters:
      kSegment - DOCUMENT ME!
      kCircle - DOCUMENT ME!
      akPoint - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • find

      private static int find(javax.vecmath.Point2f kP, MjVector2f kD, javax.vecmath.Point2f kC, float fR, float[] afT)
      Intersection of a the line P+t*D and the circle |X-C| = R. The t value is a root to the quadratic equation: 0 = |t*D+P-C|^2 - R^2 = |D|^2*t^2 + 2*D.Dot(P-C)*t + |P-C|^2-R^2 = a2*t^2 + 2*a1*t + a0 If two roots are returned, the order is T[0] invalid input: '<' T[1]. Hopefully the application will be kind and provide line directions D that are not so small that a2 is nearly zero and potentially creates numerical problems. The t parameter for the points of intersection are returned in the afT array which must have length 2.
      Parameters:
      kP - DOCUMENT ME!
      kD - DOCUMENT ME!
      kC - DOCUMENT ME!
      fR - DOCUMENT ME!
      afT - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • find

      private static int find(javax.vecmath.Point2f kP0, MjVector2f kD0, javax.vecmath.Point2f kP1, MjVector2f kD1, MjVector2f kDiff, float[] afT)
      Intersection is a solution to P0+s*D0 = P1+t*D1. Rewrite as s*D0 - t*D1 = P1 - P0, a 2x2 system of equations. If D0 = (x0,y0) and D1 = (x1,y1) and P1 - P0 = (c0,c1), then the system is x0*s - x1*t = c0 and y0*s - y1*t = c1. The error tests are relative to the size of the direction vectors, |Cross(D0,D1)| >= e*|D0|*|D1| rather than absolute tests |Cross(D0,D1)| >= e. The quantities P1-P0, |D0|^2, and |D1|^2 are returned for use by calling functions.
      Parameters:
      kP0 - DOCUMENT ME!
      kD0 - DOCUMENT ME!
      kP1 - DOCUMENT ME!
      kD1 - DOCUMENT ME!
      kDiff - DOCUMENT ME!
      afT - DOCUMENT ME!
      Returns:
      DOCUMENT ME!