Class PlanePtr


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

      • PlanePtr

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

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

        public PlanePtr​(Plane ptr)
        Do not take ownership of ptr.

        ptr can be null.

        The constructor is implicit on purpose.
    • Method Detail

      • getCPtr

        public static long getCPtr​(PlanePtr obj)
      • delete

        public void delete()
      • deref

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

        public Plane __ref__()
        Dereferencing operator.
      • getDeref

        public Plane getDeref()
        Member access operator.
      • equals

        public boolean equals​(Plane 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
      • normal

        public Vector3D normal()
        get plane normal
      • distance

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

        The distance includes the sign s.t. a negative distance corresponds to point
        being behind the plane and a positive distance in front of the plane.

        Parameters:
        point -
      • distance

        public double distance​(Plane plane)
        Default metric for computing the difference between 2 planes
        Parameters:
        plane - [in]
      • refit

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

        A PCA analysis of the points are made and the two axes with
        largest extends are used for defining the plane. The error is the
        sum of the squared mean of the points to the plane.

        The plane normal always points in the positive z-direction.

        Parameters:
        data - [in] a set of points
        Returns:
        fitting error
      • intersection

        public Vector3D intersection​(Vector3D p1,
                                     Vector3D p2)
        Calculates the intersection between the line and plane.

        The line defined by p1 and p2 is considered infinitely long.
        Throws a rw::core::Exception if the line is parallel to the plane.

        Parameters:
        p1 - [in] point 1 on the line
        p2 - [in] point 2 on the line
      • createMesh

        public TriMeshPtr createMesh​(int resolution)
      • createMesh

        public TriMeshPtr createMesh​(int resolution,
                                     double size)
        Create a triangle mesh representing the plane.

        Provides the posibility to specify the size of the plan.
        Parameters:
        resolution - [in] Resolution of the mesh (not applicable for a plane)
        size - [in] Size of the plane.
      • getParameters

        public Q getParameters()
      • setParameters

        public void setParameters​(Q q)
      • makeMetric

        public MetricPlanePtr makeMetric​(double angToDistWeight)
        Create a metric that can be used to compare distance between
        two planes. The distance between two planes is computed as follows:

        val = 0.5*angle(p1.normal, p2.normal)*angToDistWeight + 0.5*fabs(p1.d-p2.d);
        Returns:
        distance metric
      • makeMetric

        public MetricPlanePtr makeMetric()
        Create a metric that can be used to compare distance between
        two planes. The distance between two planes is computed as follows:

        val = 0.5*angle(p1.normal, p2.normal)*angToDistWeight + 0.5*fabs(p1.d-p2.d);
        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