Package org.robwork.sdurw_geometry
Class Plane
- java.lang.Object
-
- org.robwork.sdurw_geometry.GeometryData
-
- org.robwork.sdurw_geometry.Primitive
-
- org.robwork.sdurw_geometry.Plane
-
public class Plane extends Primitive
plane primitive represented in Hessian normal-form: a*nx+b*ny+c*nz+d=0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.robwork.sdurw_geometry.GeometryData
GeometryData.GeometryType
-
-
Constructor Summary
Constructors Constructor Description Plane()Constructor.
Makes a plane on X-Y surface.Plane(long cPtr, boolean cMemoryOwn)Plane(Q q)constructorPlane(Vector3D n, double d)constructorPlane(Vector3D p1, Vector3D p2, Vector3D p3)constructor - calculates the plane from 3 vertices
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TriMeshPtrcreateMesh(int resolution)make a trimesh from this primitive.TriMeshPtrcreateMesh(int resolution, double size)Create a triangle mesh representing the plane.
Provides the posibility to specify the size of the plan.SWIGTYPE_p_doubled()get distance to {0,0,0} from plane along normal.voiddelete()doubledistance(Plane plane)Default metric for computing the difference between 2 planesdoubledistance(Vector3D point)Calculates the shortest distance from point to plane.
The distance includes the sign s.t.static longgetCPtr(Plane obj)QgetParameters()get the parameters that define this primitiveGeometryData.GeometryTypegetType()the type of this primitiveVector3Dintersection(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.
static MetricPlanePtrmakeMetric()Create a metric that can be used to compare distance between
two planes.static MetricPlanePtrmakeMetric(double angToDistWeight)Create a metric that can be used to compare distance between
two planes.Vector3Dnormal()get plane normaldoublerefit(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.voidsetParameters(Q q)set the parameters that define this primitivejava.lang.StringtoString()-
Methods inherited from class org.robwork.sdurw_geometry.Primitive
getCPtr, getTriMesh, getTriMesh, isConvex, isInside
-
Methods inherited from class org.robwork.sdurw_geometry.GeometryData
getCPtr, toString
-
-
-
-
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 planed- [in] distance from plane to (0,0,0) in direction of normal
-
-
Method Detail
-
getCPtr
public static long getCPtr(Plane obj)
-
normal
public Vector3D normal()
get plane normal
-
d
public SWIGTYPE_p_double d()
get distance to {0,0,0} from plane along 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 linep2- [in] point 2 on the line
-
createMesh
public TriMeshPtr createMesh(int resolution)
Description copied from class:Primitivemake a trimesh from this primitive. Use granularity to
specify minimum number of line segments a half circle is split into- Overrides:
createMeshin classPrimitive- 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:Primitiveget the parameters that define this primitive- Overrides:
getParametersin classPrimitive
-
setParameters
public void setParameters(Q q)
Description copied from class:Primitiveset the parameters that define this primitive- Overrides:
setParametersin classPrimitive
-
getType
public GeometryData.GeometryType getType()
Description copied from class:GeometryDatathe type of this primitive- Overrides:
getTypein classGeometryData
-
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:
toStringin classjava.lang.Object
-
-