Class Plane


  • public class Plane
    extends Primitive
    plane primitive represented in Hessian normal-form: a*nx+b*ny+c*nz+d=0
    • Constructor Detail

      • Plane

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

        public Plane()
        Constructor.

        Makes a plane on X-Y surface.
      • Plane

        public Plane​(Q q)
        constructor
        Parameters:
        q -
      • Plane

        public Plane​(Vector3D n,
                     double d)
        constructor
        Parameters:
        n - [in] normal of plane
        d - [in] distance from plane to (0,0,0) in direction of normal
      • Plane

        public Plane​(Vector3D p1,
                     Vector3D p2,
                     Vector3D p3)
        constructor - calculates the plane from 3 vertices
        Parameters:
        p1 - [in] vertice 1
        p2 - [in] vertice 2
        p3 - [in] vertice 3
    • Method Detail

      • getCPtr

        public static long getCPtr​(Plane obj)
      • 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)
        Description copied from class: Primitive
        make a trimesh from this primitive. Use granularity to
        specify minimum number of line segments a half circle is split into
        Overrides:
        createMesh in class Primitive
        Parameters:
        resolution - [in]
      • 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()
        Description copied from class: Primitive
        get the parameters that define this primitive
        Overrides:
        getParameters in class Primitive
      • setParameters

        public void setParameters​(Q q)
        Description copied from class: Primitive
        set the parameters that define this primitive
        Overrides:
        setParameters in class Primitive
      • makeMetric

        public static 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 static 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