mesh.h

来自「finite element mesh 参数化有限元网格划分」· C头文件 代码 · 共 922 行 · 第 1/3 页

H
922
字号
	*/
	RESULT getEdgesIDsCount(EdgeID& count);

	/** Get the total number of faces in the mesh model
		\param count \out The number of faces
		\retval OK Operation succeeded
	*/
	RESULT getFacesCount(FaceID& count);

	/** Get the number of lines to draw
		\param count \out The number of lines
		\retval OK Operation succeeded
	*/
	RESULT getLinesCount(LineID& count);

	/** Get the number of spheres to draw
		\param count \out The number of spheres
		\retval OK Operation succeeded
	*/
	RESULT getSpheresCount(SphereID& count);

	/** Get the number of cylinders to draw
		\param count \out The number of cylinders
		\retval OK Operation succeeded
	*/
	RESULT getCylindersCount(SphereID& count);

	/** Get the number of plates to draw
		\param count \out The number of plates
		\retval OK Operation succeeded
	*/
	RESULT getPlatesCount(PlateID& count);

	/** Move given vertex to a given location
		\param vID The ID of the vertex to move.
		\param coord The new vertex coordinate
		\retval OK Operation succeeded
		\retval VertexNotFound No vertex was found with the given ID
	*/
	RESULT setCoord(VertexID vID, Coord coord);	

	/** Move given vertices to given locations
		\param vertices A list of the IDs of the vertices to move
		\param coords The new vertices coordinates
		\retval OK Operation succeeded
		\retval VertexNotFound No vertex was found with one of the given IDs
		\retval NullPointerGiven One of the given lists is NULL
		\note The entries in \e coords list should correspond to the entries in \e vertices. 
			That is, the first entry in \e coords should be the new coordinate for the first entry in \e vertices, and so on.\n
			The changes will be visible on the screen only after all vertices are moved (or if a problem occurs before that).\n
			If the lists have different lengths (meaning there are extra vertices IDs or extra coordinates), the extra data in the longer list will be ignored.
	*/
	RESULT setCoords(const LinkedList<VertexID> *vertices, const LinkedList<Coord> *coords);

	/** Get the coordinate of the given vertex
		\param vID The ID of the vertex
		\param coord \out The coordinate of the vertex
		\retval OK Operation succeeded
		\retval VertexNotFound No vertex was found with the given ID
	*/
	RESULT getCoord(VertexID vID, Coord &coord);

	/** Get the coordinates of the given vertices
		\param vertices A list of all the vertices IDs we want to get coords from
		\param coords \out The corresponding vertices' coordinates
		\retval OK Operation succeeded
		\retval VertexNotFound No vertex was found with one of the given IDs
		\retval NullPointerGiven One of the given lists is NULL
		\note The entries in \e coords correspond to the entries in the \e vertices. 
			That is, the first entry in \e coords is the coordinate for the first entry in \e vertices, and so on.
	*/
	RESULT getCoords(const LinkedList<VertexID> *vertices, LinkedList<Coord> *coords);

	/** Get the coordinates of all the valid mesh vertices, including their IDs
		\param vertices \out All the valid vertices' IDs
		\param coords \out The corresponding vertices' coordinates
		\retval OK Operation succeeded
		\retval NullPointerGiven One of the given lists is NULL
		\note \e vertices contain all the valid mesh vertices' IDs.\n
			The entries in \e coords correspond to the entries in the \e vertices. 
			That is, the first entry in \e coords is the coordinate for the first entry in \e vertices, and so on.
	*/
	RESULT getAllCoords(LinkedList<VertexID> *vertices, LinkedList<Coord> *coords);

	/** Get the edge with the given ID
		\param eID The edge ID
		\param edge \out A copy of the edge
		\retval OK Operation succeeded
		\retval EdgeNotFound No edge was found with the given ID
	*/
	RESULT getEdge(EdgeID eID, Edge& edge);

	/** Get the face with the given ID
		\param fID The face ID
		\param face \out A copy of the face
		\retval OK Operation succeeded
		\retval FaceNotFound No face was found with the given ID
	*/
	RESULT getFace(FaceID fID, Face& face);

	/** Get the faces of the given faces IDs
		\param facesids A list of all the faces IDs we want to get faces from
		\param faces \out The corresponding faces
		\retval OK Operation succeeded
		\retval FaceNotFound No face was found with one of the given IDs
		\retval NullPointerGiven One of the given lists is NULL
		\note The entries in \e faces correspond to the entries in the \e facesids. 
			That is, the first entry in \e faces is the face of the first entry in \e facesids, and so on.
	*/
	RESULT getFaces(const LinkedList<FaceID> *facesids, LinkedList<Face> *faces);

	/** Get all valid mesh faces, including their IDs
		\param facesids \out All the valid faces' IDs
		\param faces \out The corresponding faces
		\retval OK Operation succeeded
		\retval NullPointerGiven One of the given lists is NULL
		\note \e facesids contain all the valid faces' IDs.\n
			The entries in \e faces correspond to the entries in the \e facesids. 
			That is, the first entry in \e faces is the face of the first entry in \e facesids, and so on.
	*/
	RESULT getAllFaces(LinkedList<FaceID> *facesids, LinkedList<Face> *faces);

	/** Get the other edgeID of the edge with the given edgeID. Since each edge is actually made of 2 half-edges,
		each edge can have 2 EdgeID's (if there are 2 triangles attached to it).
		\param eID The edge ID
		\param otherEdgeID \out The other edgeID of the given edge. If equals '-1', there is only one ID for the given edge
		\retval OK Operation succeeded
		\retval EdgeNotFound No edge was found with the given ID
	*/
	RESULT getOtherEdgeID(EdgeID eID, EdgeID& otherEdgeID);

	/** Get the ID of the edge joining the 2 given faces. 
		Since the edge actually has 2 IDs (one when appearing in the first face, and another when appearing in the second face), 
		this function actually returns both of the IDs
		\param fID1 The ID of the first face
		\param fID2 The ID of the second face
		\param eID1 \out The ID of the joined edge (associated with the first face)
		\param eID2 \out The ID of the joined edge (associated with the second face)
		\retval OK Operation succeeded
		\retval FaceNotFound No face was found with one of the given IDs
		\retval FacesNotIncident The 2 faces are not incident.
		\retval SameFaceGiven The 2 given face IDs are the same

	*/
	RESULT getJoinedFacesEdge(FaceID fID1, FaceID fID2, EdgeID &eID1, EdgeID &eID2);

	/** Get the ID of the joined edge between the 2 given vertices. If the joined edge has 2 IDs, this function returns both of them. 
		If it has only one (there's only one face connecting the two vertices), the ID is returned in eID1, and eID2 is -1
		\param vID1 The ID of the first vertex
		\param vID2 The ID of the second vertex
		\param eID1 \out The ID of the joined edge
		\param eID2 \out The other ID of the joined edge
		\retval OK Operation succeeded
		\retval VertexNotFound No vertex was found with one of the given IDs
		\retval VerticesNotIncident The 2 vertices are not incident.
		\retval SameVertexGiven The 2 given vertex IDs are the same
	*/
	RESULT getJoinedVerticesEdge(VertexID vID1, VertexID vID2, EdgeID &eID1, EdgeID &eID2);

	/** Get the ID of the joined face of the 3 given vertices
		\param vID1 The ID of the first vertex
		\param vID2 The ID of the second vertex
		\param vID3 The ID of the third vertex
		\param fID \out The ID of the joined face
		\retval OK Operation succeeded
		\retval VertexNotFound No vertex was found with one of the given IDs
		\retval VerticesNotIncident The 3 vertices are not incident (do not form a face)
		\retval SameVertexGiven At least 2 of the given vertex IDs are the same
	*/
	RESULT getJoinedVerticesFace(VertexID vID1, VertexID vID2, VertexID vID3, FaceID &fID);

	/** Get the ID of the joined vertex between the two given edges
		\param eID1 The ID of the first edge
		\param eID2 The ID of the second edge
		\param vID \out The ID of the joined vertex
		\retval OK Operation succeeded
		\retval EdgeNotFound No edge was found with one of the given IDs
		\retval EdgesNotIncident The 2 edges are not incident (do not share a vertex)
		\retval SameEdgeGiven The 2 given edge IDs represent the same edge
	*/
	RESULT getJoinedEdgesVertex(EdgeID eID1, EdgeID eID2, VertexID &vID);

	/** Get the 2 vertices which define the given edge
		\param eID The ID of the edge
		\param vID1 \out The ID of the first vertex
		\param vID2 \out The ID of the second vertex
		\retval OK Operation succeeded
		\retval EdgeNotFound No edge was found with the given ID
	*/
	RESULT getVerticesOfEdge(EdgeID eID, VertexID &vID1,VertexID &vID2);

	/** Get the face associated with this half edge
		\param eID The ID of the edge
		\param fID \out The ID of the associated face
		\retval OK Operation succeeded
		\retval EdgeNotFound No edge was found with the given ID
	*/
	RESULT getFaceOfEdge(EdgeID eID, FaceID &fID);

	/** Get the neighborhood of the given face (its vertices, edges, and neighboring faces). 
		\param fID The ID of the face
		\param vertices \out If not NULL, will contain the face vertices' IDs (in ccw order)
		\param edges \out If not NULL, will contain the face edges' IDs (in ccw order)
		\param faces \out If not NULL, will contain the face's neighboring faces IDs (in ccw order)
		\retval OK Operation succeeded
		\retval FaceNotFound No face was found with the given ID
		\retval NullPointerGiven All 3 given lists are NULL
		\note The output lists need to be allocated before use. Also, the function does not empty the lists before use, so make sure the lists are empty (unless you want the new data to be added to previous list elements).\n
			Some of the lists can be NULL, if you don't want to get that data. For example, if you don't want to get the list of edges, just send NULL
			intead of \e edges
	*/
	RESULT getFaceNeighborhood(FaceID fID, LinkedList<VertexID>* vertices=NULL, LinkedList<EdgeID>* edges=NULL, LinkedList<FaceID>* faces=NULL);

	/** Get the neighborhood of the given vertex (adjacent vertices, edges, and neighboring faces). 
		\param vID The ID of the vertex
		\param vertices \out If not NULL, will contain the IDs of the vertices which are adjacent to the given vertex (in ccw order)
		\param edges \out If not NULL, will contain the IDs of the edges which are adjacent to the given vertex (in ccw order)
		\param faces \out If not NULL, will contain the IDs of the faces which are adjacent to the given vertex (in ccw order)
		\retval OK Operation succeeded
		\retval VertexNotFound No vertex was found with the given ID
		\retval VertexIsOrphan The given vertex is an orphan (is not associated with any face).
		\retval NullPointerGiven All 3 given lists are NULL
		\note This function does not work well if the vertex is complex.\n
			The output lists need to be allocated before use. Also, the function does not empty the lists before use, so make sure the lists are empty (unless you want the new data to be added to previous list elements).\n
			Some of the lists can be NULL, if you don't want to get that data. For example, if you don't want to get the list of edges, just send NULL
			intead of \e edges
	*/
	RESULT getNeighborhood(VertexID vID, LinkedList<VertexID>* vertices=NULL, LinkedList<EdgeID>* edges=NULL, LinkedList<FaceID>* faces=NULL);

	/** Remove the given vertex and all its incident edges and faces, leaving a hole where the faces were
		\param vID The ID of the vertex to remove
		\param removedFaces \out If not NULL, will contain the IDs of the faces which were removed during the process
		\param removedEdges \out If not NULL, will contain the IDs of the edges which were removed by this operation (the removed faces' edges) 
		\retval OK Operation succeeded
		\retval VertexNotFound No vertex was found with the given ID
		\note The output list needs to be allocated before use. Also, the function does not empty the list before use, so make sure the list is empty (unless you want the new data to be added to previous list elements).
		\sa removeVertexTriangulate()
	*/
	RESULT removeVertex(VertexID vID, LinkedList<FaceID>* removedFaces=NULL, LinkedList<EdgeID>* removedEdges=NULL);

	/** Remove the given vertex and all its associated faces, then retriangulate the hole that was created, according to \e newFacesIndices. 
		Each element in the list is a Face, which represents a new face to be created.
		\param vID The ID of the vertex to remove
		\param newFaces A list of new faces which represents new faces to be created
		\param newFacesIDs \out If not NULL, will contain the IDs of the new faces which were created during the retriangulation
		\param removedFaces \out If not NULL, will contain the IDs of the faces which were removed during the process
		\param removedEdges \out If not NULL, will contain the IDs of the edges which were removed by this operation (the removed faces' edges) 
		\retval OK Operation succeeded
		\retval VertexNotFound No vertex was found with the given ID
		\retval NullPointerGiven \e newFaces is NULL
		\note The output lists need to be allocated before use. Also, the function does not empty the lists before use, so make sure the lists are empty (unless you want the new data to be added to previous list elements).
		\sa removeVertex()
	*/
	RESULT removeVertexTriangulate(VertexID vID, const LinkedList<Face>* newFaces, LinkedList<FaceID>* newFacesIDs=NULL, LinkedList<FaceID>* removedFaces=NULL, LinkedList<EdgeID>* removedEdges=NULL);

	/** Removes the given face
		\param fID The ID of the face to remove
		\param affectedVertices \out If not NULL, will contain the IDs of the vertices affected by this operation (the removed face's vertices)
		\param removedEdges \out If not NULL, will contain the IDs of the edges which were removed by this operation (the removed face's edges) 
		\retval OK Operation succeeded
		\retval FaceNotFound No face was found with the given ID
		\note The output lists need to be allocated before use. Also, the function does not empty the lists before use, so make sure the lists are empty (unless you want the new data to be added to previous list elements).
	*/
	RESULT removeFace(FaceID fID, LinkedList<VertexID>* affectedVertices=NULL, LinkedList<EdgeID>* removedEdges=NULL);

	/** Performs an "edge collapse": move the first vertex until it collapses with the second vertex. 
		Because of this action 2 edges will be joined and 2 faces will be removed
		\param vID1 The ID of the vertex to move from
		\param vID2 The ID of the vertex to move to
		\param coordinate The new coordinate of the joined vertex.
		\param removedFaces \out If not NULL, will contain the IDs of the faces which were removed during the process 
		\param removedEdges \out If not NULL, will contain the IDs of the edges which were removed during the process
		\retval OK Operation succeeded
		\retval VertexNotFound No vertex was found with one of the given IDs
		\retval VerticesNotIncident The 2 vertices are not incident
		\retval SameVertexGiven The 2 given vertex IDs are the same
		\note The ID of the merged vertex is vID2. If \e coordinate is not NULL, this vertex will be moved to the new coordinate. Otherwise, its coordinate will be the same as of vID2.\n
			The output lists need to be allocated before use. Also, the function does not empty the lists before use, so make sure the lists are empty (unless you want the new data to be added to previous list elements).
		\sa edgeCollapseGraphic()
	*/
	RESULT edgeCollapse(VertexID vID1, VertexID vID2, const Coord *coordinate=NULL, LinkedList<FaceID>* removedFaces=NULL, LinkedList<EdgeID>* removedEdges=NULL);

	/** Does the same operation as edgeCollapse(), but shows it nicely on the screen. 
		The first vertex is seen as moving towards the second vertex until they merge
		\param vID1 The ID of the vertex to move from
		\param vID2 The ID of the vertex to move to
		\param steps The number of steps to show on the screen
		\param coordinate The new coordinate of the joined vertex.
		\param removedFaces \out If not NULL, will contain the IDs of the faces which were removed during the process 
		\param removedEdges \out If not NULL, will contain the IDs of the edges which were removed during the process
		\retval OK Operation succeeded
		\retval VertexNotFound No vertex was found with one of the given IDs
		\retval VerticesNotIncident The 2 vertices are not incident
		\retval SameVertexGiven The 2 given vertex IDs are the same
		\note The ID of the merged vertex is vID2. If \e coordinate is not NULL, this vertex will be moved to the new coordinate. Otherwise, its coordinate will be the same as of vID2.\n
			The output lists need to be allocated before use. Also, the function does not empty the lists before use, so make sure the lists are empty (unless you want the new data to be added to previous list elements).
		\sa edgeCollapse()
	*/
	RESULT edgeCollapseGraphic(VertexID vID1, VertexID vID2, int steps, const Coord *coordinate=NULL, LinkedList<FaceID>* removedFaces=NULL, LinkedList<EdgeID>* removedEdges=NULL);

	/** Split the given vertex to a new vertex, then move it to the given location. 
		The left and right vertices define the vertices which will be attached to the new vertex. All the vertices between left and right (in ccw order) will become the adjacent vertices of the split vertex
		\param vID The ID of the vertex to split
		\param coordinate The coordinate of the new vertex.
		\param left ID of the vertex to the left of the original vertex.
		\param right ID of the vertex to the right of the original vertex
		\param newVertex \out The ID of the new vertex.
		\param newFacesIDs \out If not NULL, will contain the ID's of the new faces which were created

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?