Package org.robwork.sdurw_geometry
Class PlanePtr
- java.lang.Object
-
- org.robwork.sdurw_geometry.PlanePtr
-
public class PlanePtr extends java.lang.Object
Ptr stores a pointer and optionally takes ownership of the value.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Plane
__ref__()
Dereferencing operator.PlaneCPtr
cptr()
TriMeshPtr
createMesh(int resolution)
TriMeshPtr
createMesh(int resolution, double size)
Create a triangle mesh representing the plane.
Provides the posibility to specify the size of the plan.SWIGTYPE_p_double
d()
get distance to {0,0,0} from plane along normal.void
delete()
Plane
deref()
The pointer stored in the object.double
distance(Plane plane)
Default metric for computing the difference between 2 planesdouble
distance(Vector3D point)
Calculates the shortest distance from point to plane.
The distance includes the sign s.t.boolean
equals(Plane p)
static long
getCPtr(PlanePtr obj)
Plane
getDeref()
Member access operator.Q
getParameters()
TriMeshPtr
getTriMesh()
Note: primitives allways return a new trimeshTriMeshPtr
getTriMesh(boolean forceCopy)
Note: primitives allways return a new trimeshGeometryData.GeometryType
getType()
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.
boolean
isConvex()
boolean
isInside(Vector3D point)
test if a point is on the border or inside this primitiveboolean
isNull()
checks if the pointer is nullboolean
isShared()
check if this Ptr has shared ownership or none
ownershipMetricPlanePtr
makeMetric()
Create a metric that can be used to compare distance between
two planes.MetricPlanePtr
makeMetric(double angToDistWeight)
Create a metric that can be used to compare distance between
two planes.Vector3D
normal()
get plane normaldouble
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.void
setParameters(Q q)
java.lang.String
toString()
-
-
-
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
-
cptr
public PlaneCPtr cptr()
-
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)
-
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)
-
getType
public GeometryData.GeometryType getType()
-
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 classjava.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
-
-