Class LinePtr


  • public class LinePtr
    extends java.lang.Object
    Ptr stores a pointer and optionally takes ownership of the value.
    • Constructor Detail

      • LinePtr

        public LinePtr​(long cPtr,
                       boolean cMemoryOwn)
      • LinePtr

        public LinePtr()
        Default constructor yielding a NULL-pointer.
      • LinePtr

        public LinePtr​(Line ptr)
        Do not take ownership of ptr.

        ptr can be null.

        The constructor is implicit on purpose.
    • Method Detail

      • getCPtr

        public static long getCPtr​(LinePtr obj)
      • delete

        public void delete()
      • deref

        public Line deref()
        The pointer stored in the object.
      • __ref__

        public Line __ref__()
        Dereferencing operator.
      • getDeref

        public Line getDeref()
        Member access operator.
      • equals

        public boolean equals​(Line p)
      • isShared

        public boolean isShared()
        check if this Ptr has shared ownership or none
        ownership
        Returns:
        true if Ptr has shared ownership, false if it has no ownership.
      • isNull

        public boolean isNull()
        checks if the pointer is null
        Returns:
        Returns true if the pointer is null
      • p1

        public Vector3D p1()
        Get point 1.
      • p2

        public Vector3D p2()
        Get point 2.
      • dir

        public Vector3D dir()
        Get a direction vector u = normalize(p2 - p1).
      • distance

        public double distance​(Vector3D point)
        Calculates the shortest distance from a point to the line.

        For the purposes of this calculation, the line is treated as infinitely extending
        geometric entity, without begining nor end.
      • distance

        public double distance​(Line line)
        Calculates the shortest distance to another line.

        For the purposes of this calculation, the lines are treated as infinitely extending
        geometric entity, without begining nor end.
      • closestPoint

        public Vector3D closestPoint​(Vector3D point)
        Finds a point on the line closest to specified point.

        For the purposes of this calculation, the line is treated as infinitely extending
        geometric entity, without begining nor end.
      • refit

        public double refit​(SWIGTYPE_p_std__vectorT_rw__math__Vector3DT_double_t_t data)
        Fit this line to a set of points

        Uses centroid calculation and SVD analysis to determine the parameters of the line.
        p1 is the point on the line closest to origin {0, 0, 0},
        and p2 is chosen so as (p2 - p1) is an unit vector.
        Error is the sum of point distances to the line squared.

        Parameters:
        data - [in] a set of points

        Returns:
        sum of the squares of point distances to the line
      • createMesh

        public TriMeshPtr createMesh​(int resolution)
      • getParameters

        public Q getParameters()
      • setParameters

        public void setParameters​(Q q)
      • makeGrid

        public VectorLine makeGrid​(int dim_x,
                                   int dim_y,
                                   double size_x,
                                   double size_y,
                                   Vector3D xdir,
                                   Vector3D ydir)
        Create set of lines making a grid.
      • makeGrid

        public VectorLine makeGrid​(int dim_x,
                                   int dim_y,
                                   double size_x,
                                   double size_y,
                                   Vector3D xdir)
        Create set of lines making a grid.
      • makeGrid

        public VectorLine makeGrid​(int dim_x,
                                   int dim_y,
                                   double size_x,
                                   double size_y)
        Create set of lines making a grid.
      • makeGrid

        public VectorLine makeGrid​(int dim_x,
                                   int dim_y,
                                   double size_x)
        Create set of lines making a grid.
      • makeGrid

        public VectorLine makeGrid​(int dim_x,
                                   int dim_y)
        Create set of lines making a grid.
      • makeMetric

        public MetricLinePtr makeMetric​(double angToDistWeight)
        create a metric that can be used to compare the difference between
        two lines. The distance between two lines is computed as follows:

        val = 0.5*angle(l1.dir, l2.dir)*angToDistWeight + 0.5*l1.distance(l2)
        Returns:
        distance metric
      • makeMetric

        public MetricLinePtr makeMetric()
        create a metric that can be used to compare the difference between
        two lines. The distance between two lines is computed as follows:

        val = 0.5*angle(l1.dir, l2.dir)*angToDistWeight + 0.5*l1.distance(l2)
        Returns:
        distance metric
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getTriMesh

        public TriMeshPtr getTriMesh​(boolean forceCopy)

        Note: primitives allways return a new trimesh
      • getTriMesh

        public TriMeshPtr getTriMesh()

        Note: primitives allways return a new trimesh
      • isConvex

        public boolean isConvex()
      • isInside

        public boolean isInside​(Vector3D point)
        test if a point is on the border or inside this primitive