Package org.robwork.sdurw_geometry
Class BREPPtr
- java.lang.Object
-
- org.robwork.sdurw_geometry.BREPPtr
-
public class BREPPtr 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 BREP
__ref__()
Dereferencing operator.void
addVertex(Vector3D point)
Add a vertex to the BREP.BREPPtr
clone()
Make a deep copy of the BREP.BREPCPtr
cptr()
void
delete()
BREP
deref()
The pointer stored in the object.long
edgeCount()
The number of edges.OBB
edgeOBR(long edge)
Create Oriented Bounding Rectangle for an edge.boolean
equals(BREP p)
long
faceCount()
The number of faces.
The number of faces is the number of loops, where a surface has been attached.
pair_d_d
faceExtremums(long faceIndex, Vector3D dir)
Find the extent of the surface along a specific direction.
If the surface has no lower bound, the value -%std::numeric_limits<double>::%max() can
be returned to indicate that the surface has unbounded minimum value in the given
direction.
If the surface has no upper bound, the value %std::numeric_limits<double>::%max() can
be returned to indicate that the surface has unbounded maximum value in the given
direction.
OBB
faceOBB(long faceIndex)
Create Oriented Bounding Box for a face.TriMeshPtr
faceTriMesh(long faceIndex)
Construct a Triangle Mesh for a face.SWIGTYPE_p_rw__core__PtrT_rw__geometry__BREP__CommonCurveSet_const_t
getCommonCurves(SWIGTYPE_p_std__setT_unsigned_long_t faces)
Get a set of common curves between a set of faces.static long
getCPtr(BREPPtr obj)
Curve
getCurve(long curveIndex)
Get curve.SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__geometry__Curve_t_t
getCurves(long loopIdx)
Get the curves in a given loop.
The curves will be traversed in an ordered way, and curves will have a direction that
leads to the next curve.
BREP
getDeref()
Member access operator.Surface
getSurface(long surfaceIndex)
Get surface.long
getSurfaceIndex(long loop)
Get the surface index of a loop.TriMeshPtr
getTriMesh()
Create a TriMesh representation from this boundary representation.
This function relies on the resolution set with setMeshResolution.
The resolution is passed on to Curve::discretizeAdaptive and
Surface::setDiscretizationResolution.
TriMeshPtr
getTriMesh(boolean forceCopy)
Create a TriMesh representation from this boundary representation.
This function relies on the resolution set with setMeshResolution.
The resolution is passed on to Curve::discretizeAdaptive and
Surface::setDiscretizationResolution.
GeometryData.GeometryType
getType()
Vector3D
getVertex(long vertexIndex)
Get vertex.SWIGTYPE_p_std__vectorT_rw__math__Vector3DT_double_t_t
getVertices(long loopIdx)
Get the vertices in a given loop.
The curves will be traversed in an ordered way around the loop.
boolean
hasSurfaceSet(long loop)
Check if a certain loop has a surface set.boolean
isConvex()
boolean
isNull()
checks if the pointer is nullboolean
isShared()
check if this Ptr has shared ownership or none
ownershiplong
loopCount()
The number of loops.void
makeLoop(int singleEdgeId)
Create a loop containing a single edge (typically for circles and ellipses and
similar).
The half-edge structure requires that an edge must start and end in a vertex.OBB
obb()
Create Oriented Bounding Box where the directions are estimated.
This method is more expensive than obb(const rw::math::Rotation3D<>&),
because a TriMesh is formed to estimated the principal directions of the OBB.
OBB
obb(SWIGTYPE_p_rw__math__Rotation3DT_t R)
Create Oriented Bounding Box with certain principal directions.void
printObj()
Print the structure of the BREP for debugging purposes.void
scale(double factor)
Scale the object.void
setMeshResolution()
Set the resolution used for discretization in the getTriMesh and faceTriMesh
functions.
The meaning of this parameter depends on the type of surface.
void
setMeshResolution(double resolution)
Set the resolution used for discretization in the getTriMesh and faceTriMesh
functions.
The meaning of this parameter depends on the type of surface.
ShellCPtr
shellProxy()
Get a Shell representation as a proxy to the BREP.void
stitchAuto(double eps)
Try to stitch edges automatically.void
stitchEdges(long first, long second)
java.lang.String
toString(GeometryData.GeometryType type)
format GeometryType to stringlong
verticeCount()
The number of vertices.
-
-
-
Constructor Detail
-
BREPPtr
public BREPPtr(long cPtr, boolean cMemoryOwn)
-
BREPPtr
public BREPPtr()
Default constructor yielding a NULL-pointer.
-
BREPPtr
public BREPPtr(BREP ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
-
Method Detail
-
getCPtr
public static long getCPtr(BREPPtr obj)
-
delete
public void delete()
-
deref
public BREP deref()
The pointer stored in the object.
-
__ref__
public BREP __ref__()
Dereferencing operator.
-
getDeref
public BREP getDeref()
Member access operator.
-
equals
public boolean equals(BREP 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 BREPCPtr cptr()
-
getType
public GeometryData.GeometryType getType()
-
getTriMesh
public TriMeshPtr getTriMesh(boolean forceCopy)
Create a TriMesh representation from this boundary representation.
This function relies on the resolution set with setMeshResolution.
The resolution is passed on to Curve::discretizeAdaptive and
Surface::setDiscretizationResolution.
- Parameters:
forceCopy
- [in] generate a new copy, or use a cached TriMesh.- Returns:
- a new TriMesh if forceCopy is true, or a shared cached TriMesh if forceCopy
is false.
-
getTriMesh
public TriMeshPtr getTriMesh()
Create a TriMesh representation from this boundary representation.
This function relies on the resolution set with setMeshResolution.
The resolution is passed on to Curve::discretizeAdaptive and
Surface::setDiscretizationResolution.
- Returns:
- a new TriMesh if forceCopy is true, or a shared cached TriMesh if forceCopy
is false.
-
isConvex
public boolean isConvex()
-
getSurface
public Surface getSurface(long surfaceIndex)
Get surface.- Parameters:
surfaceIndex
- [in] the index of the surface. Should be less than the number
returned by size().- Returns:
- a reference to the surface.
-
getCurve
public Curve getCurve(long curveIndex)
Get curve.- Parameters:
curveIndex
- [in] index of the curve. Should be less than the number returned by
edgeCount().- Returns:
- a reference to the curve.
-
scale
public void scale(double factor)
Scale the object.- Parameters:
factor
- [in] the factor to scale with.
-
clone
public BREPPtr clone()
Make a deep copy of the BREP.- Returns:
- a copy of the BREP.
-
shellProxy
public ShellCPtr shellProxy()
Get a Shell representation as a proxy to the BREP.- Returns:
- smart pointer to a Shell proxy object.
-
getCurves
public SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__geometry__Curve_t_t getCurves(long loopIdx)
Get the curves in a given loop.
The curves will be traversed in an ordered way, and curves will have a direction that
leads to the next curve.
- Parameters:
loopIdx
- [in] the loop index.- Returns:
- an ordered vector of curves.
-
getCommonCurves
public SWIGTYPE_p_rw__core__PtrT_rw__geometry__BREP__CommonCurveSet_const_t getCommonCurves(SWIGTYPE_p_std__setT_unsigned_long_t faces)
Get a set of common curves between a set of faces.- Parameters:
faces
- [in] loop indexes for the faces to consider.- Returns:
- set of common curves as a CommonCurveSet.
-
faceCount
public long faceCount()
The number of faces.
The number of faces is the number of loops, where a surface has been attached.
- Returns:
- the number of faces.
-
loopCount
public long loopCount()
The number of loops.- Returns:
- the number of loops.
-
edgeCount
public long edgeCount()
The number of edges.- Returns:
- the number of edges.
-
verticeCount
public long verticeCount()
The number of vertices.- Returns:
- the number of vertices.
-
getVertex
public Vector3D getVertex(long vertexIndex)
Get vertex.- Parameters:
vertexIndex
- [in] index of the vertex. Should be less than the number returned by
vertices().- Returns:
- reference to the vertex.
-
getVertices
public SWIGTYPE_p_std__vectorT_rw__math__Vector3DT_double_t_t getVertices(long loopIdx)
Get the vertices in a given loop.
The curves will be traversed in an ordered way around the loop.
- Parameters:
loopIdx
- [in] the loop index.- Returns:
- a collection of vertices.
-
hasSurfaceSet
public boolean hasSurfaceSet(long loop)
Check if a certain loop has a surface set.- Parameters:
loop
- [in] index of the loop, which should be less than loopCount().- Returns:
- true if a surface is set, false otherwise.
-
getSurfaceIndex
public long getSurfaceIndex(long loop)
Get the surface index of a loop.- Parameters:
loop
- [in] the loop index.- Returns:
- the corresponding surface index.
-
obb
public OBB obb(SWIGTYPE_p_rw__math__Rotation3DT_t R)
Create Oriented Bounding Box with certain principal directions.- Parameters:
R
- [in] the directions for the bounding box.- Returns:
- an OBB around the BREP.
-
obb
public OBB obb()
Create Oriented Bounding Box where the directions are estimated.
This method is more expensive than obb(const rw::math::Rotation3D<>&),
because a TriMesh is formed to estimated the principal directions of the OBB.
- Returns:
- an OBB around the BREP.
-
addVertex
public void addVertex(Vector3D point)
Add a vertex to the BREP.- Parameters:
point
- [in] the vertex to add.
-
makeLoop
public void makeLoop(int singleEdgeId)
Create a loop containing a single edge (typically for circles and ellipses and
similar).
The half-edge structure requires that an edge must start and end in a vertex. Sometimes
it is possible to have an edge without any vertices. This is, for example, the case for a
circular or elliptic cylinder, where there will be two circular or elliptic edges.
It is necessary to place one vertex on the circle or ellipse that can act as both the
start and end vertex for the curve.
- Parameters:
singleEdgeId
- [in] id of the edge to create loop for. 1-indexing is expected, with
a sign that indicates the edge direction.
-
stitchEdges
public void stitchEdges(long first, long second)
-
stitchAuto
public void stitchAuto(double eps)
Try to stitch edges automatically.- Parameters:
eps
- [in] distance threshold for vertices and curves.
-
faceOBB
public OBB faceOBB(long faceIndex)
Create Oriented Bounding Box for a face.- Parameters:
faceIndex
- [in] the face index, which should be less than loopCount().- Returns:
- OBB for the given face.
-
edgeOBR
public OBB edgeOBR(long edge)
Create Oriented Bounding Rectangle for an edge.- Parameters:
edge
- [in] the edge index, which should be less than edgeCount().- Returns:
- OBB for the given edge (with third half-length set to zero).
-
faceExtremums
public pair_d_d faceExtremums(long faceIndex, Vector3D dir)
Find the extent of the surface along a specific direction.
If the surface has no lower bound, the value -%std::numeric_limits<double>::%max() can
be returned to indicate that the surface has unbounded minimum value in the given
direction.
If the surface has no upper bound, the value %std::numeric_limits<double>::%max() can
be returned to indicate that the surface has unbounded maximum value in the given
direction.
- Parameters:
faceIndex
- [in] the face index, which should be less than loopCount().dir
- [in] a normalized direction vector.- Returns:
- the minimum and maximum values along the given direction.
-
faceTriMesh
public TriMeshPtr faceTriMesh(long faceIndex)
Construct a Triangle Mesh for a face.- Parameters:
faceIndex
- [in] the face index, which should be less than loopCount().- Returns:
- a triangle mesh.
-
setMeshResolution
public void setMeshResolution(double resolution)
Set the resolution used for discretization in the getTriMesh and faceTriMesh
functions.
The meaning of this parameter depends on the type of surface.
- Parameters:
resolution
- [in] the resolution parameter.
-
setMeshResolution
public void setMeshResolution()
Set the resolution used for discretization in the getTriMesh and faceTriMesh
functions.
The meaning of this parameter depends on the type of surface.
-
printObj
public void printObj()
Print the structure of the BREP for debugging purposes.
-
toString
public java.lang.String toString(GeometryData.GeometryType type)
format GeometryType to string- Parameters:
type
-
-
-