RPolyMeshData
Class in Entity Module
Header: #include <src/entity/RPolyMeshData.h>
Inherits: REntityData
Description
Section titled “Description”Stores and manages all data that defines the geometry of a polygon mesh entity: a list of vertices and a list of faces, each face referring to three or more vertices by index (indexed mesh with shared vertices).
The faces are stored as one flat list: for every face the number of vertices followed by the vertex indices (0-based), e.g. 3 0 1 2 4 1 5 6 2 for a triangle followed by a quad (the layout of the DXF MESH entity). Optionally, edges can be marked as hidden (see isEdgeHidden): the edge with index k of a face starts at the vertex with index k of that face.
Geometry algorithms (edges, triangulation, reference points, splitting) are implemented by a proxy (see RPolyMeshDataProxy). Without proxy, a mesh holds its data but has no shapes and no reference points.
Scriptable: This class is available in script environments.
Copyable: Objects are cleaned up automatically by the garbage collector of the script engine.
Public Functions
Section titled “Public Functions”RPolyMeshData() |
|
RPolyMeshData(const QList< RVector > &vertices, const QList< int > &faces) |
|
| virtual | ~RPolyMeshData() |
| int | addFace(const QList< int > &indices)Appends a face with the given vertex indices (at least three). |
| int | addQuad(int v1, int v2, int v3, int v4) |
| int | addTriangle(int v1, int v2, int v3) |
| int | addVertex(const RVector &v)Appends the given vertex. |
| void | append(const RPolyMeshData &other)Appends the vertices and faces of the given mesh to this mesh. |
| void | clear() |
| virtual bool | cloneOnChange() constThe geometry of a mesh is not accessible as properties, the whole entity is replaced when it changes (see REntityData::cloneOnChange). |
| int | countFaces() const |
| int | countVertices() const |
| virtual bool | flipHorizontal() |
| virtual bool | flipVertical() |
| virtual RBox | getBoundingBox(bool ignoreEmpty=false) const |
| QList< int > | getFace(int index) const |
| QList< int > | getFaces() const |
| int | getFaceVertexCount(int index) const |
| QList< bool > | getHiddenEdges() const |
| virtual QList< RRefPoint > | getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const |
| virtual QList< QSharedPointer< RShape > > | getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false, QList< RObject::Id > *entityIds=NULL) const |
| QList< RTriangle > | getTriangles() const |
| virtual RS::EntityType | getType() const |
| RVector | getVertexAt(int index) const |
| QList< RVector > | getVertices() const |
| bool | hasHiddenEdges() const |
| bool | isEdgeHidden(int faceIndex, int edgeIndex) const |
| virtual bool | isSane() const |
| bool | isTriangleMesh() const |
| virtual bool | isValid() const |
| virtual bool | mirror(const RLine &axis) |
| virtual bool | move(const RVector &offset)Moves this entity by the given offset. |
| virtual bool | moveReferencePoint(const RVector &referencePoint, const RVector &targetPoint, Qt::KeyboardModifiers modifiers=Qt::NoModifier)Moves the given reference point to the given target point or does nothing if this entity has no reference point as the given location. |
| virtual bool | rotate(double rotation, const RVector ¢er=RDEFAULT_RVECTOR) |
| virtual bool | scale(const RVector &scaleFactors, const RVector ¢er=RDEFAULT_RVECTOR) |
| void | setEdgeHidden(int faceIndex, int edgeIndex, bool hidden) |
| void | setFaces(const QList< int > &f) |
| void | setHiddenEdges(const QList< bool > &h) |
| void | setVertexAt(int index, const RVector &v) |
| void | setVertices(const QList< RVector > &v) |
| virtual void | setZ(double z) |
| QList< RPolyMeshData > | split(int maxVertices, int maxFaces, int maxFaceVertices=4) constSplits this mesh into parts with at most the given number of vertices and faces, each face with at most the given number of vertices (see RPolyMeshDataProxy::split). |
| virtual bool | stretch(const RPolyline &area, const RVector &offset)Stretches the end points of this entity that are inside area by offset. |
| virtual void | to2D() |
Static Public Functions
Section titled “Static Public Functions”| static RPolyMeshDataProxy * | getPolyMeshDataProxy() |
| static bool | hasProxy() |
| static void | setPolyMeshDataProxy(RPolyMeshDataProxy *p) |
Protected Functions
Section titled “Protected Functions”RPolyMeshData(RDocument *document, const RPolyMeshData &data) |
Private Functions
Section titled “Private Functions”| void | updateFaceIndex() const |
Private Attributes
Section titled “Private Attributes”| QList< int > | faceOffsets |
| bool | faceOffsetsValid |
| QList< int > | faces |
| QList< bool > | hiddenEdges |
| QList< RVector > | vertices |
Static Private Attributes
Section titled “Static Private Attributes”| static RPolyMeshDataProxy * | polyMeshDataProxy |
Friends
Section titled “Friends”| class | RPolyMeshEntity |
Member Documentation
Section titled “Member Documentation”RPolyMeshData
Section titled “RPolyMeshData”RPolyMeshData::RPolyMeshData()RPolyMeshData
Section titled “RPolyMeshData”RPolyMeshData::RPolyMeshData(const QList< RVector > &vertices, const QList< int > &faces)~RPolyMeshData
Section titled “~RPolyMeshData”virtual RPolyMeshData::~RPolyMeshData()virtual inline
addFace
Section titled “addFace”int RPolyMeshData::addFace(const QList< int > &indices)Appends a face with the given vertex indices (at least three).
Returns: The index of the new face or -1.
addQuad
Section titled “addQuad”int RPolyMeshData::addQuad(int v1, int v2, int v3, int v4)addTriangle
Section titled “addTriangle”int RPolyMeshData::addTriangle(int v1, int v2, int v3)addVertex
Section titled “addVertex”int RPolyMeshData::addVertex(const RVector &v)Appends the given vertex.
Returns: The index of the new vertex.
append
Section titled “append”void RPolyMeshData::append(const RPolyMeshData &other)Appends the vertices and faces of the given mesh to this mesh.
void RPolyMeshData::clear()cloneOnChange
Section titled “cloneOnChange”virtual bool RPolyMeshData::cloneOnChange() constvirtual inline const
The geometry of a mesh is not accessible as properties, the whole entity is replaced when it changes (see REntityData::cloneOnChange).
Reimplemented from cloneOnChange.
countFaces
Section titled “countFaces”int RPolyMeshData::countFaces() constconst
countVertices
Section titled “countVertices”int RPolyMeshData::countVertices() constinline const
flipHorizontal
Section titled “flipHorizontal”virtual bool RPolyMeshData::flipHorizontal()virtual
Reimplemented from flipHorizontal.
flipVertical
Section titled “flipVertical”virtual bool RPolyMeshData::flipVertical()virtual
Reimplemented from flipVertical.
getBoundingBox
Section titled “getBoundingBox”virtual RBox RPolyMeshData::getBoundingBox(bool ignoreEmpty=false) constvirtual const
Returns: The bounding box that contains this entity.
Reimplemented from getBoundingBox.
getFace
Section titled “getFace”QList< int > RPolyMeshData::getFace(int index) constconst
Returns: The vertex indices of the face with the given index (empty if out of range).
getFaces
Section titled “getFaces”QList< int > RPolyMeshData::getFaces() constinline const
Returns: The flat face list (vertex count followed by the vertex indices for every face, see class description).
getFaceVertexCount
Section titled “getFaceVertexCount”int RPolyMeshData::getFaceVertexCount(int index) constconst
Returns: The number of vertices of the face with the given index (0 if out of range).
getHiddenEdges
Section titled “getHiddenEdges”QList< bool > RPolyMeshData::getHiddenEdges() constinline const
Returns: Hidden edge flags, one per entry of the face list (entries of vertex counts unused), empty if no edges are hidden.
getReferencePoints
Section titled “getReferencePoints”virtual QList< RRefPoint > RPolyMeshData::getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) constvirtual const
Returns: Vector of reference points of this entity. Reference points can usually be moved around by the user to change the geometry of the entity.
Reimplemented from getReferencePoints.
getShapes
Section titled “getShapes”virtual QList< QSharedPointer< RShape > > RPolyMeshData::getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false, QList< RObject::Id > *entityIds=NULL) constvirtual const
Returns: Shapes that represent the geometry of this entity.
Parameters:
queryBox: Limit returned shapes to query boxignoreComplex: Ignore complex shapes and explode those into simple shapessegment: Split up splines into spline segments
Reimplemented from getShapes.
getTriangles
Section titled “getTriangles”QList< RTriangle > RPolyMeshData::getTriangles() constconst
Returns: The faces of this mesh as triangles (empty without proxy).
getType
Section titled “getType”virtual RS::EntityType RPolyMeshData::getType() constvirtual inline const
Reimplemented from getType.
getVertexAt
Section titled “getVertexAt”RVector RPolyMeshData::getVertexAt(int index) constconst
getVertices
Section titled “getVertices”QList< RVector > RPolyMeshData::getVertices() constinline const
hasHiddenEdges
Section titled “hasHiddenEdges”bool RPolyMeshData::hasHiddenEdges() constinline const
Returns: True if the mesh has hidden edges.
isEdgeHidden
Section titled “isEdgeHidden”bool RPolyMeshData::isEdgeHidden(int faceIndex, int edgeIndex) constconst
Returns: True if the given edge of the given face is hidden (edge k of a face starts at vertex k of the face).
isSane
Section titled “isSane”virtual bool RPolyMeshData::isSane() constvirtual const
Returns: True if all faces have at least three vertices and refer to existing vertices (false without proxy).
Reimplemented from isSane.
isTriangleMesh
Section titled “isTriangleMesh”bool RPolyMeshData::isTriangleMesh() constconst
Returns: True if all faces are triangles.
isValid
Section titled “isValid”virtual bool RPolyMeshData::isValid() constvirtual inline const
Reimplemented from isValid.
mirror
Section titled “mirror”virtual bool RPolyMeshData::mirror(const RLine &axis)virtual
Reimplemented from mirror.
virtual bool RPolyMeshData::move(const RVector &offset)virtual
Moves this entity by the given offset.
Reimplemented from move.
moveReferencePoint
Section titled “moveReferencePoint”virtual bool RPolyMeshData::moveReferencePoint(const RVector &referencePoint, const RVector &targetPoint, Qt::KeyboardModifiers modifiers=Qt::NoModifier)virtual
Moves the given reference point to the given target point or does nothing if this entity has no reference point as the given location.
Returns: True if a reference point has been moved successfully, false otherwise.
Reimplemented from moveReferencePoint.
rotate
Section titled “rotate”virtual bool RPolyMeshData::rotate(double rotation, const RVector ¢er=RDEFAULT_RVECTOR)virtual
Reimplemented from rotate.
virtual bool RPolyMeshData::scale(const RVector &scaleFactors, const RVector ¢er=RDEFAULT_RVECTOR)virtual
Reimplemented from scale.
setEdgeHidden
Section titled “setEdgeHidden”void RPolyMeshData::setEdgeHidden(int faceIndex, int edgeIndex, bool hidden)setFaces
Section titled “setFaces”void RPolyMeshData::setFaces(const QList< int > &f)setHiddenEdges
Section titled “setHiddenEdges”void RPolyMeshData::setHiddenEdges(const QList< bool > &h)setVertexAt
Section titled “setVertexAt”void RPolyMeshData::setVertexAt(int index, const RVector &v)setVertices
Section titled “setVertices”void RPolyMeshData::setVertices(const QList< RVector > &v)inline
virtual void RPolyMeshData::setZ(double z)virtual
Reimplemented from setZ.
QList< RPolyMeshData > RPolyMeshData::split(int maxVertices, int maxFaces, int maxFaceVertices=4) constconst
Splits this mesh into parts with at most the given number of vertices and faces, each face with at most the given number of vertices (see RPolyMeshDataProxy::split).
Without proxy, this mesh is returned as one part.
stretch
Section titled “stretch”virtual bool RPolyMeshData::stretch(const RPolyline &area, const RVector &offset)virtual
Stretches the end points of this entity that are inside area by offset.
Reimplemented from stretch.
virtual void RPolyMeshData::to2D()virtual
Reimplemented from to2D.
getPolyMeshDataProxy
Section titled “getPolyMeshDataProxy”static RPolyMeshDataProxy * RPolyMeshData::getPolyMeshDataProxy()static inline
Non-Scriptable: This function is not available in script environments.
hasProxy
Section titled “hasProxy”static bool RPolyMeshData::hasProxy()static inline
setPolyMeshDataProxy
Section titled “setPolyMeshDataProxy”static void RPolyMeshData::setPolyMeshDataProxy(RPolyMeshDataProxy *p)static inline
Non-Scriptable: This function is not available in script environments.
RPolyMeshData
Section titled “RPolyMeshData”RPolyMeshData::RPolyMeshData(RDocument *document, const RPolyMeshData &data)protected
updateFaceIndex
Section titled “updateFaceIndex”void RPolyMeshData::updateFaceIndex() constconst private
faceOffsets
Section titled “faceOffsets”QList<int> RPolyMeshData::faceOffsetsprivate
faceOffsetsValid
Section titled “faceOffsetsValid”bool RPolyMeshData::faceOffsetsValidprivate
QList<int> RPolyMeshData::facesprivate
hiddenEdges
Section titled “hiddenEdges”QList<bool> RPolyMeshData::hiddenEdgesprivate
vertices
Section titled “vertices”QList<RVector> RPolyMeshData::verticesprivate
polyMeshDataProxy
Section titled “polyMeshDataProxy”static RPolyMeshDataProxy * RPolyMeshData::polyMeshDataProxy = NULLstatic private
All rights reserved.
This file is part of the QCAD project.
QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with QCAD.
RPolyMeshEntity
Section titled “RPolyMeshEntity”friend class RPolyMeshEntityprivate