# doc-cache created by Octave 10.2.0
# name: cache
# type: cell
# rows: 3
# columns: 105
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
Contents


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9845
CONTENTS MESHES3D 3D Surface Meshes.
 Version 1.22 06-Jun-2018.

   Creation, visualization, and manipulation of 3D surface meshes or
   polyhedra.

   Meshes and Polyhedra are represented by a couple of variables {V, F}:
   V: Nv-by-3 array of vertices: [x1 y1 z1; ... ; xn yn zn];
   F: is either a NF-by-3 or NF-by-4 array containing reference for
   vertices of each face, or a NF-by-1 cell array, where each cell is an
   array containing a variable number of node indices.
   For some functions, the array E of edges is needed. It consists in a
   NE-by-2 array containing indices of source and target vertices. 

   The library provides function to create basic polyhedric meshes (the
   five platonic solids, plus few others), as well as functions to perform
   basic computations (surface area, normal angles, face centroids...).
   The 'MengerSponge' structure is an example of mesh that is not simply
   connected (multiple tunnels in the structure).

   The drawMesh function is mainly a wrapper to the Matlab 'patch'
   function, allowing passing arguments more quickly.

   Example
     % create a soccer ball mesh and display it
     [v, e, f] = createSoccerBall;
     drawMesh(v, f, 'faceColor', 'g', 'linewidth', 2);
     axis equal; view(3);
  

 General processing on meshes
   smoothMesh                  - Smooth mesh by replacing each vertex by the average of its neighbors.
   subdivideMesh               - Subdivides each face of the mesh.
   meshVertexClustering        - Simplifies a mesh using vertex clustering.
   triangulateFaces            - Convert face array to an array of triangular faces.
   transformMesh               - Applies a 3D affine transform to a mesh.
   mergeCoplanarFaces          - Merge coplanar faces of a polyhedral mesh.
   meshFacePolygons            - Returns the set of polygons that constitutes a mesh.
   meshFaceCentroids           - Compute centroids of faces in a mesh.
   meshFaceNormals             - Compute normal vector of faces in a 3D mesh.
   meshVertexNormals           - Compute normals to a mesh vertices.
   meshComplement              - Reverse the normal of each face in the mesh.
   averageMesh                 - Compute average mesh from a list of meshes.
   meshSilhouette              - Compute the 2D outline of a 3D mesh on an arbitrary plane.
   meshVoronoiDiagram          - Voronoi Diagram on the surface of a polygonal mesh.

 Intersections and clipping
   intersectLineMesh3d         - Intersection points of a 3D line with a mesh.
   intersectEdgeMesh3d         - Intersection points of a 3D edge with a mesh.
   intersectPlaneMesh          - Compute the polygons resulting from plane-mesh intersection.
   polyhedronSlice             - Intersect a convex polyhedron with a plane.
   clipMeshByPlane             - Clip a mesh by a plane.
   clipMeshVertices            - Clip vertices of a surfacic mesh and remove outer faces.
   clipConvexPolyhedronByPlane - Clip a convex polyhedron by a plane.
   cutMeshByPlane              - Cut a mesh by a plane.
   concatenateMeshes           - Concatenate multiple meshes.
   splitMesh                   - Return the connected components of a mesh.

 Geometric measures on meshes
   meshSurfaceArea             - Surface area of a polyhedral mesh.
   trimeshSurfaceArea          - Surface area of a triangular mesh.
   meshFaceAreas               - Surface area of each face of a mesh.
   meshVolume                  - (Signed) volume of the space enclosed by a polygonal mesh.
   meshCurvatures              - Compute principal curvatures on mesh vertices.
   meshEdgeLength              - Lengths of edges of a polygonal or polyhedral mesh.
   meshDihedralAngles          - Dihedral at edges of a polyhedal mesh.
   polyhedronCentroid          - Compute the centroid of a 3D convex polyhedron.
   tetrahedronVolume           - Signed volume of a tetrahedron.
   polyhedronNormalAngle       - Compute normal angle at a vertex of a 3D polyhedron.
   polyhedronMeanBreadth       - Mean breadth of a convex polyhedron.
   trimeshMeanBreadth          - Mean breadth of a triangular mesh.
   isPointInMesh               - Check if a point is inside a 3D mesh.
   distancePointMesh           - Shortest distance between a (3D) point and a triangle mesh.

 Utility functions
   meshFace                    - Return the vertex indices of a face in a mesh.
   meshFaceEdges               - Computes edge indices of each face.
   meshFaceNumber              - Returns the number of faces in this mesh.
   meshEdges                   - Computes array of edge vertex indices from face array.
   meshEdgeFaces               - Compute index of faces adjacent to each edge of a mesh.
   trimeshEdgeFaces            - Compute index of faces adjacent to each edge of a triangular mesh.
   meshFaceAdjacency           - Compute adjacency list of face around each face.
   meshAdjacencyMatrix         - Compute adjacency matrix of a mesh from set of faces.
   checkMeshAdjacentFaces      - Check if adjacent faces of a mesh have similar orientation.
   meshBoundary                - Boundary of a mesh as a collection of 3D line strings.
   meshBoundaryEdges           - Determine the boundary edges of a mesh.
   meshBoundaryEdgeIndices     - Indices of boundary edges of a mesh.
   meshBoundaryVertexIndices   - Indices of boundary vertices of a mesh.
   smoothMeshFunction          - Apply smoothing on a functions defines on mesh vertices.

 Basic edition on meshes
   removeMeshVertices          - Remove vertices and associated faces from a mesh.
   mergeMeshVertices           - Merge two vertices and removes eventual degenerated faces.
   removeMeshFaces             - Remove faces from a mesh by face indices.

 Mesh cleanup
   trimMesh                    - Reduce memory footprint of a polygonal mesh.
   isManifoldMesh              - Check whether the input mesh may be considered as manifold.
   ensureManifoldMesh          - Apply several simplification to obtain a manifold mesh.
   removeDuplicateFaces        - Remove duplicate faces in a face array.
   removeDuplicateVertices     - Remove duplicate vertices of a mesh.
   removeUnreferencedVertices  - Remove unreferenced vertices of a mesh.
   removeMeshEars              - Remove vertices that are connected to only one face.
   removeInvalidBorderFaces    - Remove faces whose edges are connected to 3, 3, and 1 faces.
   collapseEdgesWithManyFaces  - Remove mesh edges adjacent to more than two faces.

 Creation and conversion
   surfToMesh                  - Convert surface grids into face-vertex mesh.
   triangulateCurvePair        - Compute triangulation between a pair of 3D open curves.
   triangulatePolygonPair3d    - Compute a triangulation between a pair of 3D polygons.
   triangulatePolygonPair      - Compute triangulation between a pair of 3D closed curves.
   circleMesh                  - Create a mesh defined by a 3D circle.
   cylinderMesh                - Create a 3D mesh representing a cylinder.
   sphereMesh                  - Create a 3D mesh representing a sphere.
   ellipsoidMesh               - Convert a 3D ellipsoid to face-vertex mesh representation.
   torusMesh                   - Create a 3D mesh representing a torus.
   curveToMesh                 - Create a mesh surrounding a 3D curve.
   boxToMesh                   - Convert a box into a quad mesh with the same size.
   minConvexHull               - Return the unique minimal convex hull of a set of 3D points.

 Create meshes representing polyhedra
   polyhedra                   - Index of classical polyhedral meshes.
   createCube                  - Create a 3D mesh representing the unit cube.
   createOctahedron            - Create a 3D mesh representing an octahedron.
   createCubeOctahedron        - Create a 3D mesh representing a cube-octahedron.
   createIcosahedron           - Create a 3D mesh representing an Icosahedron.
   createDodecahedron          - Create a 3D mesh representing a dodecahedron.
   createTetrahedron           - Create a 3D mesh representing a tetrahedron.
   createRhombododecahedron    - Create a 3D mesh representing a rhombododecahedron.
   createTetrakaidecahedron    - Create a 3D mesh representing a tetrakaidecahedron.
   createSoccerBall            - Create a 3D mesh representing a soccer ball.
   createStellatedMesh         - Replaces each face of a mesh by a pyramid.
   createDurerPolyhedron       - Create a mesh representing Durer's polyhedron .
   createMengerSponge          - Create a cube with an inside cross removed.
   steinerPolytope             - Create a steiner polytope from a set of vectors.

 Drawing functions
   drawMesh                    - Draw a 3D mesh defined by vertex and face arrays.
   drawPolyhedron              - Draw polyhedron defined by vertices and faces.
   fillMeshFaces               - Fill the faces of a mesh with the specified colors.
   drawFaceNormals             - Draw normal vector of each face in a mesh.

 I/O functions
   readMesh                    - Read a 3D mesh by inferring format from file name.
   writeMesh                   - Write 3D mesh data by inferring format from file name.
   readMesh_off                - Read mesh data stored in OFF format.
   readMesh_obj                - Read mesh data stored in OBJ format.
   readMesh_ply                - Read mesh data stored in PLY (Stanford triangle) format.
   readMesh_stl                - Read mesh data stored in STL format.
   writeMesh_off               - Write a mesh into a text file in OFF format.
   writeMesh_ply               - Write a mesh into a file in PLY format.
   writeMesh_stl               - Write mesh data in the STL format.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
CONTENTS MESHES3D 3D Surface Meshes.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
averageMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1310
AVERAGEMESH Compute average mesh from a list of meshes.

   AVGMESH = averageMesh(MESHLIST)
   Where MESHLIST is a cell array of meshes, computes an average mesh that
   minimizes the sum of squared distances between average mesh vertices
   and all other mesh vertices.
   The method is to choose an arbitrary reference mesh, and to iterate a
   series of smoothin of the reference mesh, computation of nearest vertex
   neighbors, and computing average position of nearest neighbors.

   [AVGMESH, DISTS] = averageMesh(MESHLIST)
   Returns also a cell array containing for each iteration, the standard
   deviation of distances to other individual meshes.

   [AVGMESH, DISTS, VERT_ITERS] = averageMesh(MESHLIST)
   Also returns for each iteration, the positions of the average vertices.

   [AVGMESH, DISTS] = averageMesh(..., PNAME, PVALUE)
   Provides addition options are parameter name-value pairs. Available
   options are:
   * verbose: (logical, default false) display or not information about
       process
   * nIters: number of smooth-projection iterations to perform. Default
       value is 10.
   * smoothingIteration: the number of smoothing operations to apply on
       average mesh at each iteration. Default value is 3.


   Example
   averageMesh

   See also 
     meshes3d, smoothMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
AVERAGEMESH Compute average mesh from a list of meshes.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
boxToMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 827
BOXTOMESH Convert a box into a quad mesh with the same size.

   [V E F] = boxToMesh(BOX) 
   Create a box as a polyhedra representation. The box is defined by its  
   coordinate extents: BOX = [XMIN XMAX YMIN YMAX ZMIN ZMAX] 
   The result has the form [V E F], where V is a 8-by-3 array with vertex
   coordinates, E is a 12-by-2 array containing indices of neighbour
   vertices, and F is a 6-by-4 array containing vertices array of each
   face.

   [V F] = boxToMesh(BOX)
   Returns only the vertices and the face vertex indices.

   MESH = boxToMesh(BOX)
   Returns the data as a mesh structure, with fields 'vertices', 'edges'
   and 'faces'.
   
   ... = boxToMesh()
   Creates a unit cube

   Example
   [v, f] = boxToMesh([-2 -1 0 pi 2 3])
   drawMesh(v, f);
   
   See also 
   meshes3d, drawMesh, triangulateFaces



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
BOXTOMESH Convert a box into a quad mesh with the same size.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
checkMeshAdjacentFaces


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 748
CHECKMESHADJACENTFACES Check if adjacent faces of a mesh have similar orientation.

   checkMeshAdjacentFaces(VERTICES, EDGES, FACES)
   The functions returns no output, but if two faces share a common edge
   with the same direction (meaning that adjacent faces have normals in
   opposite direction), a warning is displayed. 
   
   Example
   [v e f] = createCube();
   checkMeshAdjacentFaces(v, e, f);
   % no output -> all faces have normal outwards of the cube

   v = [0 0 0; 10 0 0; 0 10 0; 10 10 0];
   e = [1 2;1 3;2 3;2 4;3 4];
   f = [1 2 3; 2 3 4];
   checkMeshAdjacentFaces(v, e, f);
      Warning: Faces 1 and 2 run through the edge 3 (2-3) in the same direction

   See also 
     meshes3d, trimeshMeanBreadth




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
CHECKMESHADJACENTFACES Check if adjacent faces of a mesh have similar orienta...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
circleMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 759
CIRCLEMESH Create a mesh defined by a 3D circle.

   [V, F] = cylinderMesh(CYL)
   Computes vertex coordinates V and face vertex indices F of a mesh
   representing a 3D circle given as [xc yc zc R theta phi psi].

   [V, F] = cylinderMesh(..., NAME, VALUE);
   Specifies one or several options using parameter name-value pairs.
   Available options are:
       'nP' the number of points represeting the perimeter
       'nR' the number of points along the radius excluding the center

   Example
     c = [10 20 30 50 70 60 50];
     [v, f] = circleMesh(c, 'nP',100, 'nR',50);
     figure('color','w');
     drawMesh(v, f, 'facecolor', 'r');
     drawCircle3d(c,'LineWidth',2, 'Color','g');
     view(3); axis equal;

   See also 
   cylinderMesh, circles3d



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
CIRCLEMESH Create a mesh defined by a 3D circle.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
clipConvexPolyhedronByPlane


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 879
CLIPCONVEXPOLYHEDRONBYPLANE Clip a convex polyhedron by a plane.

   [NODES2, FACES2] = clipConvexPolyhedronByPlane(NODES, FACES, PLANE)

   return the new (convex) polyhedron whose vertices are 'below' the
   specified plane, and with faces clipped accordingly. NODES2 contains
   clipped vertices and new created vertices, FACES2 contains references
   to NODES2 vertices.

   Example
     [N, F] = createCube;
     P = createPlane([.5 .5 .5], [1 1 1]);
     [N2, F2] = clipConvexPolyhedronByPlane(N, F, P);
     figure('color','w'); view(3); axis equal
     drawPolyhedron(N2, F2);
 
     [v, f] = createSoccerBall;
     p = createPlane([-.5 .5 -.5], [1 1 1]);
     [v2, f2] = clipConvexPolyhedronByPlane(v, f, p);
     figure('color','w'); view(3); axis equal
     drawMesh(v, f, 'faceColor', 'none');
     drawMesh(v2, f2);

   See also 
     meshes3d, polyhedra, planes3d




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
CLIPCONVEXPOLYHEDRONBYPLANE Clip a convex polyhedron by a plane.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
clipMeshByPlane


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1715
CLIPMESHBYPLANE Clip a mesh by a plane.

   [V2, F2] = clipMeshByPlane(V, F, PLANE)
   Clip a mesh defined by the vertices V and faces F by a PLANE and return
   the part of the mesh (V2, F2) above the plane.

   [V2, F2, ENEW] = clipMeshByPlane(V, F, PLANE)
   Additonally returns the new boundary edges created by the clipping of
   the mesh.

   [...] = clipMeshByPlane(V, F, PLANE, 'part', 'below')
   Gives the part of the mesh below the plane. The options are:
       'part','above': Mesh above the plane [default]
       'part','below': Mesh below the plane

   Example
     % Create trefoil curve
     nPoints = 200; % Number of vertices of trefoil curve
     thickness = .5; % Thickness of the 3D mesh
     nCorners = 16; % Number of corners around each curve vertex
     t = linspace(0, 2*pi, nPoints + 1); % parameterisation variable
     t(end) = [];
     % Trefoil curve coordinates
     curve(:,1) = sin(t) + 2 * sin(2 * t);
     curve(:,2) = cos(t) - 2 * cos(2 * t);
     curve(:,3) = -sin(3 * t);
     % Create surrounding mesh
     [v2, f2] = curveToMesh(curve, thickness, nCorners);
     f2 = triangulateFaces(f2);
     % Clip the mesh by a plane
     plane = createPlane([0 0 0], [0.5 0.5 1]);
     [v2, f2, bE] = clipMeshByPlane(v2, f2, plane, 'part','above');
     % Display results
     figure('color','w'); 
     drawPolygon3d(curve, 'LineWidth', 4, 'color', 'b');
     axis equal; view(3);
     drawMesh(v2, f2, 'FaceAlpha', 0.5);
     drawPlane3d(plane)
     drawEdge3d([v2(bE(:,1),:),v2(bE(:,2),:)],'Color','g','LineWidth',4)
   
   See also 
     cutMeshByPlane, intersectPlaneMesh

   Source
     half_space_intersect.m by Alec Jacobson:
       https://github.com/alecjacobson/gptoolbox



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CLIPMESHBYPLANE Clip a mesh by a plane.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
clipMeshVertices


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1194
CLIPMESHVERTICES Clip vertices of a surfacic mesh and remove outer faces.

   [V2, F2] = clipMeshVertices(V, F, B)
   Clip a mesh represented by vertex array V and face array F, with the
   box represented by B. The result is the set of vertices contained in
   the box, and a new set of faces corresponding to original faces with
   all vertices within the box.
   
   [V2, F2] = clipMeshVertices(..., 'shape', 'sphere') Specify the shape.
   Default is 'box'. But it is also possible to use 'sphere' or 'plane'.
   
   [V2, F2] = clipMeshVertices(..., 'inside', false) removes the inner 
   faces instead of the outer faces.

   [V2, F2] = clipMeshVertices(..., 'trimMesh', TF)
   Also specifies if the isolated vertices need to be removed (TF=true) or
   not (TF=false). Default is false.

   Example
     [v, f] = createSoccerBall;
     f = triangulateFaces(f);
     box = [0 2 -1 2 -.5 2];
     [v2, f2] = clipMeshVertices(v, f, box, 'inside', false);
     figure('color','w'); view(3); axis equal
     drawMesh(v, f, 'faceColor', 'none', 'faceAlpha', .2);
     drawBox3d(box)
     drawMesh(v2, f2, 'faceAlpha', .7);

   See also 
   meshes3d, clipPoints3d




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
CLIPMESHVERTICES Clip vertices of a surfacic mesh and remove outer faces.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
collapseEdgesWithManyFaces


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 327
COLLAPSEEDGESWITHMANYFACES Remove mesh edges adjacent to more than two faces.

   [V2, F2] = collapseEdgesWithManyFaces(V, F)
   Count the number of faces adjacent to each edge, and collapse the edges
   adjacent to more than two faces. 


   Example
   collapseEdgesWithManyFaces

   See also 
       trimMesh, isManifoldMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 77
COLLAPSEEDGESWITHMANYFACES Remove mesh edges adjacent to more than two faces.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
concatenateMeshes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 397
CONCATENATEMESHES Concatenate multiple meshes.

   [V,F] = concatenateMeshes(V1,F1,V2,F2, ...)
   Returns one mesh represented by vertices V and faces F by concatenating
   the meshes defined by V1, V2, ... and F1, F2, ...

   [V,F] = concatenateMeshes(MESH1, MESH2, ...)
   where MESH1, MESH2, ... are structs or struct arrays with the fields  
   vertices and faces

   See also 
     splitMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
CONCATENATEMESHES Concatenate multiple meshes.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
createCube


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 774
CREATECUBE Create a 3D mesh representing the unit cube.

   [V, E, F] = createCube 
   Create a unit cube, as a polyhedra representation.
   c has the form [V E F], where V is a 8-by-3 array with vertices
   coordinates, E is a 12-by-2 array containing indices of neighbour
   vertices, and F is a 6-by-4 array containing vertices array of each
   face.

   [V, F] = createCube;
   Returns only the vertices and the face vertex indices.

   MESH = createCube;
   Returns the data as a mesh structure, with fields 'vertices', 'edges'
   and 'faces'.

   Example
   [n, e, f] = createCube;
   drawMesh(n, f);
   
   See also 
   meshes3d, drawMesh
   createOctahedron, createTetrahedron, createDodecahedron
   createIcosahedron, createCubeOctahedron




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
CREATECUBE Create a 3D mesh representing the unit cube.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
createCubeOctahedron


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 726
CREATECUBEOCTAHEDRON Create a 3D mesh representing a cube-octahedron.

   [V, E, F] = createCubeOctahedron;
   Cubeoctahedron can be seen either as a truncated cube, or as a
   truncated octahedron.
   V is the 12-by-3 array of vertex coordinates
   E is the 27-by-2 array of edge vertex indices
   F is the 1-by-14 cell array of face vertex indices

   [V, F] = createCubeOctahedron;
   Returns only the vertices and the face vertex indices.

   MESH = createCubeOctahedron;
   Returns the data as a mesh structure, with fields 'vertices', 'edges'
   and 'faces'.

   Example
   [n, e, f] = createCubeOctahedron;
   drawMesh(n, f);
   
   See also 
   meshes3d, drawMesh, createCube, createOctahedron




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 69
CREATECUBEOCTAHEDRON Create a 3D mesh representing a cube-octahedron.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
createDodecahedron


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 866
CREATEDODECAHEDRON Create a 3D mesh representing a dodecahedron.

   [V, E, F] = createDodecahedron;
   Create a 3D mesh representing a dodecahedron
   V is the 20-by-3 array of vertex coordinates
   E is the 30-by-2 array of edge vertex indices
   F is the 12-by-5 array of face vertex indices

   [V, F] = createDodecahedron;
   Returns only the vertices and the face vertex indices.

   MESH = createDodecahedron;
   Returns the data as a mesh structure, with fields 'vertices', 'edges'
   and 'faces'.

   Example
   [v, e, f] = createDodecahedron;
   drawMesh(v, f);

   Use values given by P. Bourke, see:
   http://local.wasp.uwa.edu.au/~pbourke/geometry/platonic/
   faces are re-oriented to have normals pointing outwards.

   See also 
   meshes3d, drawMesh
   createCube, createOctahedron, createIcosahedron, createTetrahedron




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
CREATEDODECAHEDRON Create a 3D mesh representing a dodecahedron.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
createDurerPolyhedron


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1492
CREATEDURERPOLYHEDRON  Create a mesh representing Durer's polyhedron .

   [V, F] = createDurerPolyhedron
   [V, E, F] = createDurerPolyhedron
   Returns a mesh data structure that represents Durer's polyhedron shown
   in "Melancholia". Vertices are stored in V as Nv-by-3 array of 3D
   coordinates, faces are stored in Nf-by-1 cell array containing the
   vertex indices of each face.
   Several hypotheses exist on the exact geometry of the solid. The one
   described in Mathworld (see references) is used here.

   Durer's polyhedron is generated from a centered unit cube. Several
   transforms are applied succesively:
   * Rotation around Oz by PI / 4
   * Rotation around Oy by asec(sqrt(3))
   * z-scaling by sqrt(1 + 3 / sqrt(5) )
   * truncation by two horizontal planes located at a distance of 
       (3 - sqrt(5)) / 2 from each azimutal vertex.

   Durer's polyhedron is composed of six pentagonal faces and 2 triangular
   faces. Pentagonal faces have angles 126, 108, 72, 108, and 126 degrees.
   triangular faces are equilateral.

   Example
     % Display Durer's polyhedron 
     [v f] = createDurerPolyhedron;
     figure; hold on; set(gcf, 'renderer', 'opengl');
     drawMesh(v, f, 'FaceColor', [.7 .7 .7]);
     axis equal; axis([-1 1 -1 1 -1 1]);
     view(3)

   See also 
     meshes3d, createCube, createOctahedron

   References
   http://mathworld.wolfram.com/DuerersSolid.html
   http://en.wikipedia.org/wiki/Dürer_graph



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 70
CREATEDURERPOLYHEDRON  Create a mesh representing Durer's polyhedron .



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
createIcosahedron


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 644
CREATEICOSAHEDRON Create a 3D mesh representing an Icosahedron.

   MESH = createIcosahedron;
   [V, E, F] = createIcosahedron;
   Create a solid with 12 vertices, and 20 triangular faces. Faces are
   oriented outwards of the mesh.

   [V, F] = createIcosahedron;
   Returns only the vertices and the face vertex indices.

   MESH = createIcosahedron;
   Returns the data as a mesh structure, with fields 'vertices', 'edges'
   and 'faces'.

   Example
     [n, e, f] = createIcosahedron;
     drawMesh(n, f);
   
   See also 
   meshes3d, drawMesh
   createCube, createOctahedron, createDodecahedron, createTetrahedron




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 63
CREATEICOSAHEDRON Create a 3D mesh representing an Icosahedron.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
createMengerSponge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 325
CREATEMENGERSPONGE Create a cube with an inside cross removed.

   [n, e, f] = createMengerSponge;
   Main use is to test possibility of drawing polyhedra with complex faces
   (polygonal faces with holes)

   Example
   [n, e, f] = createMengerSponge;
   drawMesh(n, f);
   
   See also 
   meshes3d, drawMesh




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 62
CREATEMENGERSPONGE Create a cube with an inside cross removed.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
createOctahedron


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1096
CREATEOCTAHEDRON Create a 3D mesh representing an octahedron.

   [V, E, F] = createOctahedron;
   Create a 3D mesh representing an octahedron
   V is a 6-by-3 array with vertices coordinate, E is a 12-by-2 array
   containing indices of neighbour vertices, and F is a 8-by-3 array
   containing array of vertex index for each face.

   [V, F] = createOctahedron;
   Returns only the vertices and the face vertex indices.

   MESH = createOctahedron;
   Returns the data as a mesh structure, with fields 'vertices', 'edges'
   and 'faces'.

   Vertices are located on grid vertices:
    ( ±1,  0,  0 )
    (  0, ±1,  0 )
    (  0,  0, ±1 )

   Edge length of returned octahedron is sqrt(2).
   Surface area of octahedron is 2*sqrt(3)*a^2, approximately 6.9282 in
   this case.
   Volume of octahedron is sqrt(2)/3*a^3, approximately 1.3333 in this
   case.

   Example
     [v, e, f] = createOctahedron;
     drawMesh(v, f);

   See also 
   meshes3d, drawMesh
   createCube, createIcosahedron, createDodecahedron, createTetrahedron
   createCubeOctahedron




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
CREATEOCTAHEDRON Create a 3D mesh representing an octahedron.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
createRhombododecahedron


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 649
CREATERHOMBODODECAHEDRON Create a 3D mesh representing a rhombododecahedron.

   [V, E, F] = createRhombododecahedron
   V is a 14-by-3 array with vertex coordinate, 
   E is a 12-by-2 array containing indices of neighbour vertices,
   F is a 8-by-3 array containing vertices array of each face.

   [V, F] = createRhombododecahedron;
   Returns only the vertices and the face vertex indices.

   MESH = createRhombododecahedron;
   Returns the data as a mesh structure, with fields 'vertices', 'edges'
   and 'faces'.

   Example
   [v, e, f] = createRhombododecahedron;
   drawMesh(v, f);


   See also 
   meshes3d, drawMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 76
CREATERHOMBODODECAHEDRON Create a 3D mesh representing a rhombododecahedron.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
createSoccerBall


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 511
CREATESOCCERBALL Create a 3D mesh representing a soccer ball.

   It is basically a wrapper of the 'bucky' function in matlab.
   [V, E, F] = createSoccerBall
   return vertices, edges and faces that constitute a soccerball
   V is a 60-by-3 array containing vertex coordinates
   E is a 90-by-2 array containing indices of neighbor vertices
   F is a 32-by-1 cell array containing vertex indices of each face
   Example
   [v, f] = createSoccerBall;
   drawMesh(v, f);

   See also 
   meshes, drawMesh, bucky



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
CREATESOCCERBALL Create a 3D mesh representing a soccer ball.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
createStellatedMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 275
CREATESTELLATEDMESH  Replaces each face of a mesh by a pyramid.

   [V2, F2] = createStellatedMesh(V, F)

   Example
     [v, f] = createCube
     [v2, f2] = createStellatedMesh(v, f);
     figure; drawMesh(v2, f2); axis equal; view(3);

   See also 
     meshes3d, drawMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 63
CREATESTELLATEDMESH  Replaces each face of a mesh by a pyramid.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
createTetrahedron


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 827
CREATETETRAHEDRON Create a 3D mesh representing a tetrahedron.

   [V, E, F] = createTetrahedron
   create a simple tetrahedron, using mesh representation. The tetrahedron
   is inscribed in the unit cube.
   V is a 4-by-3 array with vertex coordinates, 
   E is a 6-by-2 array containing indices of neighbour vertices,
   F is a 4-by-3 array containing vertices array of each (triangular) face.

   [V, F] = createTetrahedron;
   Returns only the vertices and the faces.

   MESH = createTetrahedron;
   Returns the data as a mesh structure, with fields 'vertices', 'edges'
   and 'faces'.


   Example
   % Create and display a tetrahedron
   [V, E, F] = createTetrahedron;
   drawMesh(V, F);

   See also 
   meshes3d, drawMesh
   createCube, createOctahedron, createDodecahedron, createIcosahedron



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 62
CREATETETRAHEDRON Create a 3D mesh representing a tetrahedron.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
createTetrakaidecahedron


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 844
CREATETETRAKAIDECAHEDRON Create a 3D mesh representing a tetrakaidecahedron.

   [V, E, F] = createTetrakaidecahedron;
   Create a mesh structure representing a tetrakaidecahedron, composed of
   both square and hexagonal faces. Tetrakaidecahedron can be used to tile
   the 3D Euclidean space.

   V is a 24-by-3 array with vertex coordinates,
   E is a 36-by-2 array containing indices of neighbour vertices,
   F is a 14-by-1 cell array containing vertex indices array of each face.

   [V, F] = createTetrakaidecahedron;
   Returns only the vertices and the face vertex indices.

   MESH = createTetrakaidecahedron;
   Returns the data as a mesh structure, with fields 'vertices', 'edges'
   and 'faces'.

   Example
   [n, e, f] = createTetrakaidecahedron;
   drawMesh(n, f);
   
   See also 
   meshes3d, drawMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 76
CREATETETRAKAIDECAHEDRON Create a 3D mesh representing a tetrakaidecahedron.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
curveToMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 876
CURVETOMESH Create a mesh surrounding a 3D curve.

   [V, F] = curveToMesh(CURVE)
   Computes the vertices and the faces of the mesh surrounding the
   specified 3D curve.

   [V, F] = curveToMesh(CURVE, THICKNESS)
   Specifies the thickness of the mesh (distance between mesh vertices and
   curve vertices). Default is 0.5.

   [V, F] = curveToMesh(CURVE, THICKNESS, NCORNERS)
   Also specifies the number of mesh vertices around each curve vertex.
   Default is 8.


   Example
     % Creates a tubular mesh around a trefoil knot curve
     t = linspace(0, 2*pi, 200)';
     x = sin(t) + 2 * sin(2 * t);
     y = cos(t) - 2 * cos(2 * t);
     z = -sin(3 * t);
     curve = [x, y, z];
     [v2, f2] = curveToMesh(curve, .5, 16);
     figure; 
     drawMesh(v2, f2);
     axis equal; view(3);
     axis([-4 4 -4 4 -2 2]);
  
   See also 
     meshes3d, torusMesh, surfToMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
CURVETOMESH Create a mesh surrounding a 3D curve.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
cutMeshByPlane


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 926
CUTMESHBYPLANE Cut a mesh by a plane.

   [ABOVE, IN, BELOW] = cutMeshByPlane(MESH, PLANE)
   where MESH, ABOVE, IN, BELOW are structs with the fields vertices and
   faces, and PLANE is given as a row containing initial point and 2
   direction vectors. ABOVE, IN, BELOW contain the corresponding parts of
   the input mesh.

   [ABOVE_V, ABOVE_F, IN_V, IN_F, BELOW_V,BELOW_F] = ...
       cutMeshByPlane(V, F, PLANE) where V is a [NVx3] array containing
   coordinates and F is a [NFx3] array containing indices of vertices of
   the triangular faces.

   BELOW = cutMeshByPlane(V, F, PLANE, 'part', 'below') BELOW is a struct
   with the fields vertices and faces. Other options are:
       'part'  -   'above': Faces above the plane
               -   'in'   : Faces in the plane
               -   'below': Faces below the plane

   [BELOW_V, BELOW_F] = cutMeshByPlane(MESH, PLANE, 'part', 'below') is
   possible, too.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
CUTMESHBYPLANE Cut a mesh by a plane.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
cylinderMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1397
CYLINDERMESH Create a 3D mesh representing a cylinder.

   [V, F] = cylinderMesh(CYL)
   Computes vertex coordinates and face vertex indices of a mesh
   representing a 3D cylinder given as [X1 Y1 Z1 X2 Y2 Z2 R].
   
   [V, F] = cylinderMesh(..., OPT)
   with OPT = 'open' (0) (default) or 'closed' (1), specify if the bases 
   of the cylinder should be included.
   
   [V, F] = cylinderMesh(..., NAME, VALUE);
   Specifies one or several options using parameter name-value pairs.
   Available options are:
   'nPerimeter' the number of points represeting the perimeter
   'nRho' the number of circles along the hight

   Example
     % Draw a rotated cylinder
     cyl = [0 0 0 10 20 30 5];
     [v, f] = cylinderMesh(cyl);
     figure;drawMesh(v, f, 'FaceColor', 'r');
     view(3); axis equal;

     % Draw three mutually intersecting cylinders
     p0 = [30 30 30];
     p1 = [90 30 30];
     p2 = [30 90 30];
     p3 = [30 30 90];
     [v1, f1] = cylinderMesh([p0 p1 25]);
     [v2, f2] = cylinderMesh([p0 p2 25]);
     [v3, f3] = cylinderMesh([p0 p3 25],'closed','nPeri',40,'nRho',20);
     figure; hold on;
     drawMesh(v1, f1, 'FaceColor', 'r');
     drawMesh(v2, f2, 'FaceColor', 'g');
     drawMesh(v3, f3, 'FaceColor', 'b');
     view(3); axis equal
     set(gcf, 'renderer', 'opengl')
  
   See also 
     drawCylinder, torusMesh, sphereMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
CYLINDERMESH Create a 3D mesh representing a cylinder.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
distancePointMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1897
DISTANCEPOINTMESH Shortest distance between a (3D) point and a triangle mesh.

   DIST = distancePointMesh(POINTS, VERTICES, FACES)
   Returns the shortest distance between the query point(s) POINTS and the
   triangular mesh defined by the set of vertex coordinates VERTICES and
   the set of faces FACES. POINTS is a NP-by-3 array, VERTICES is a 
   NV-by-3 array, and FACES is a NF-by-3 array of vertex indices.
   If FACES is NF-by-4 array, it is converted to a (NF*2)-by-3 array.
   DIST is the NP-by-1 vector of distances.

   [DIST, PROJ] = distancePointMesh(...)
   Also returns the NP-by-3 projection of the query point(s) on the 
   triangular mesh.

   ... = distancePointMesh(..., 'algorithm', ALGO)
   Allows to choose the type of algorithm. Options are:
   * sequential:   process each face sequentially, using the function
               distancePointTriangle3d 
   * vectorized:   vectorized algorithm, usually faster for large number
               of faces
   * auto:         (default) automatically choose the most appropriate
               between sequential and vectorized.

   Example
     [V, F] = torusMesh();
     F2 = triangulateFaces(F);
     P = [10 20 30];
     [D, PROJ] = distancePointMesh(P, V, F2);
     figure; drawMesh(V, F)
     view(3); axis equal; lighting gouraud; light;
     drawPoint3d(P);
     drawPoint3d(PROJ, 'm*');
     drawEdge3d([P PROJ], 'linewidth', 2, 'color', 'b');

   See also 
     distancePointTriangle3d

   References
   * "Distance Between Point and Triangle in 3D", David Eberly
       https://www.geometrictools.com/Documentation/DistancePoint3Triangle3.pdf
   * "Distance between a point and a triangle in 3d", by Gwendolyn Fischer
       https://mathworks.com/matlabcentral/fileexchange/22857
   * "Distance Between Point and Triangulated Surface", by Daniel Frisch
       https://www.mathworks.com/matlabcentral/fileexchange/52882



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 77
DISTANCEPOINTMESH Shortest distance between a (3D) point and a triangle mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
drawFaceNormals


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 609
DRAWFACENORMALS Draw normal vector of each face in a mesh.

   drawFaceNormals(V, E, F)
   Compute and draw the face normals of the mesh defined by vertices V,
   edges E and faces F. See meshes3d for format of each argument.

   H = drawFaceNormals(...)
   Return handle array to the created objects.

   Example
   % draw face normals of a cube
     [v, f] = createCubeOctahedron;
     figure; drawMesh(v, f)
     axis([-2 2 -2 2 -2 2]); axis equal; hold on;
     drawFaceNormals(v, f)
     view(3);

   See also 
   meshes3d, drawMesh, drawVector3d, meshFaceNormals, meshFaceCentroids




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
DRAWFACENORMALS Draw normal vector of each face in a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
drawMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1629
DRAWMESH Draw a 3D mesh defined by vertex and face arrays.

   drawMesh(VERTICES, FACES)
   Draws the 3D mesh defined by vertices VERTICES and the faces FACES. 
   vertices is a NV-by-3 array containing coordinates of vertices, and
   FACES is either a NF-by-3 or NF-by-4 array containing face vertex
   indices of the triangular or rectangular faces.
   FACES can also be a cell array, each cell containing an array of vertex
   indices for the corresponding face. In this case the faces may have
   variable number of vertices. 
   
   drawMesh(MESH)
   Specifies the mesh as a structure containing at least the fields
   'vertices' and 'faces', using the same conventions as above.

   drawMesh(..., COLOR)
   Use the specified color to render the mesh faces.

   drawMesh(..., NAME, VALUE)
   Use one or several pairs of parameter name/value to specify drawing
   options. Options are the same as the 'patch' function.

   drawMesh(AX,...) 
   Draw into the axis specified by AX instead of the current axis.


   H = drawMesh(...);
   Also returns a handle to the created patch.

   Example:
     % display a polyhedra with polygonal faces
     [v, f] = createSoccerBall;
     drawMesh(v, f);

     % Display a mesh representing a  torus, using uniform face color
     [v, f] = torusMesh;
     figure; hold on; axis equal; view(3);
     drawMesh(v, f, 'FaceColor', 'g')
     % paint the mesh according to vertex x-coordinate
     figure; hold on; axis equal; view(3);
     drawMesh(v, f, 'VertexColor', v(:,1), 'LineStyle', 'none');

   See also 
     meshes3d, polyhedra, patch




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
DRAWMESH Draw a 3D mesh defined by vertex and face arrays.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
drawPolyhedron


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 742
DRAWPOLYHEDRON Draw polyhedron defined by vertices and faces.

   drawPolyhedron(NODES, FACES)
   Draws the polyhedron defined by vertices NODES and the faces FACES. 
   NODES is a NV-by-3 array containing coordinates of vertices, and FACES
   is either a NF-by3 or NF-by-4 array containing indices of vertices of
   the triangular or rectangular faces.
   FACES can also be a cell array, in the content of each cell is an array
   of indices to the nodes of the current face. Faces can have different
   number of vertices.
   
   H = drawPolyhedron(...);
   Also returns a handle to the created patche.

   Example:
   [n f] = createSoccerBall;
   drawPolyhedron(n, f);

   See also 
   polyhedra, drawMesh, drawPolygon



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
DRAWPOLYHEDRON Draw polyhedron defined by vertices and faces.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
ellipsoidMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 666
ELLIPSOIDMESH Convert a 3D ellipsoid to face-vertex mesh representation.

   [V, F] = ellipsoidMesh(ELLI)
   ELLI is given by:
   [XC YC ZC  A B C  PHI THETA PSI],
   where (XC, YC, ZC) is the ellipsoid center, A, B and C are the half
   lengths of the ellipsoid main axes, and PHI THETA PSI are Euler angles
   representing ellipsoid orientation, in degrees.

   Example
     % compute mesh of an ellongated ellipsoid
     elli = [50 50 50   50 30 10   30 20 10];
     [v, f] = ellipsoidMesh(elli);
     figure; hold on; axis equal; axis([0 100 0 100 0 100]); view(3);
     drawMesh(v, f);

   See also 
   meshes3d, drawEllipsoid, sphereMesh, equivalentEllipsoid




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 72
ELLIPSOIDMESH Convert a 3D ellipsoid to face-vertex mesh representation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
ensureManifoldMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 406
ENSUREMANIFOLDMESH Apply several simplification to obtain a manifold mesh.

   Try to transform an input mesh into a manifold mesh.

   Not all cases of "non-manifoldity" are checked, so please use with
   care.

   [V2, F2] = ensureManifoldMesh(V, F);
   [V2, F2] = ensureManifoldMesh(MESH);
   MESH2 = ensureManifoldMesh(...);

   Example
   ensureManifoldMesh

   See also 
    meshes3d, isManifoldMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 74
ENSUREMANIFOLDMESH Apply several simplification to obtain a manifold mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
fillMeshFaces


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 973
FILLMESHFACES Fill the faces of a mesh with the specified colors.

   fillMeshFaces(V, F, VERTEXCOLORS)
   Colorizes a mesh by filling faces with an array of values. The colors
   can be a NV-by-1 array of values, or a NV-by-3 array of values.
   Face filling uses 'interp' coloring mode.

   fillMeshFaces(V, F, FACECOLORS)
   Colorizes the mesh by specifying the value or the color associated to
   each face. Face filling uses 'flat' coloring mode.

   fillMeshFaces(..., PNAME, PVALUE)
   Specifies additional parameters that will be passed to the 'patch'
   function.

   Example
     % Colorize mesh based on z-coordinate of vertices.
     [v, f] = createIcosahedron;
     values = v(:,3);
     figure; axis equal; view(3);
     fillMeshFaces(v, f, values);

     % Colorize mesh using specific color for each face
     [v, f] = createIcosahedron;
     colors = jet(20);
     figure; axis equal; view(3);
     fillMeshFaces(v, f, colors);

   See also 
     drawMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 65
FILLMESHFACES Fill the faces of a mesh with the specified colors.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
intersectEdgeMesh3d


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 765
INTERSECTEDGEMESH3D Intersection points of a 3D edge with a mesh.

   INTERS = intersectEdgeMesh3d(EDGE, VERTICES, FACES)
   Compute the intersection points between a 3D edge and a 3D mesh defined
   by vertices and faces.

   [INTERS, POS, INDS] = intersectEdgeMesh3d(EDGE, VERTICES, FACES)
   Also returns the position of each intersection point on the input edge,
   and the index of the intersected faces.
   For edges, the values of POS are expected to be comprised between 0 and
   1.
   
   Example
     [V, F] = createCube;
     edge = [-1 0.5 0.5  +3 0.5 0.5];
     pts = intersectEdgeMesh3d(edge, V, F)
     pts =
         1.0000    0.5000    0.5000
              0    0.5000    0.5000

   See also 
     meshes3d, interesectLineMesh3d, triangulateFaces




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 65
INTERSECTEDGEMESH3D Intersection points of a 3D edge with a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
intersectLineMesh3d


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1413
INTERSECTLINEMESH3D Intersection points of a 3D line with a mesh.

   INTERS = intersectLineMesh3d(LINE, VERTICES, FACES)
   Compute the intersection points between a 3D line and a 3D mesh defined
   by vertices and faces. The mesh data is provided as a pair of arrays,
   with VERTICES being a NV-by-3 array of vertex coordinates, and FACES
   being a NF-by-3 or NF-by-4 array of face vertex indices.
   The LINE data correspond to a 1-by-6 row vector concatenating the line
   origin and direction. LINE can also be a NL-by-6 array representing a
   collection of lines with various origins and directions.

   INTERS = intersectLineMesh3d(LINE, MESH)
   Provides the mesh data as a struct with the fields 'vertices' and
   'faces'.

   [INTERS, POS, IFACES] = intersectLineMesh3d(...)
   Also returns the position of each intersection point on the input line,
   and the index of the intersected faces.
   If POS > 0, the point is also on the ray corresponding to the line. 
   
   [INTERS, POS, IFACES, ILINES] = intersectLineMesh3d(...)
   Also returns the index of the line each intersection point belong to.

   Example
     [V, F] = createCube;
     line = [.2 .3 .4 1 0 0];
     pts = intersectLineMesh3d(line, V, F)
     pts =
         1.0000    0.3000    0.4000
              0    0.3000    0.4000

   See also 
   meshes3d, triangulateFaces, intersectLineTriangle3d




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 65
INTERSECTLINEMESH3D Intersection points of a 3D line with a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
intersectPlaneMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2778
INTERSECTPLANEMESH Compute the polylines resulting from plane-mesh intersection.

   POLYS = intersectPlaneMesh(P, V, F)
   [POLYS, CLOSED] = intersectPlaneMesh(P, V, F)
   Computes the intersection between a plane and a mesh. 
   The plane P is given as:
   P = [X0 Y0 Z0  DX1 DY1 DZ1  DX2 DY2 DZ2]
   The mesh is given as numeric array V of vertex coordinates and an array
   of (triangular) face vertex indices.
   The output POLYS is a cell array of polylines, where each cell contains
   a NV-by-3 numeric array of coordinates. The (optional) output CLOSED is
   a logical array the same size as the POLYS, indicating whether the
   corresponding polylines are closed (true), or open (false). 
   Use the functions 'drawPolygon3d' to display closed polylines, and
   'drawPolyline3d' to display open polylines.


   Example
     % Intersect a cube by a plane
     [v, f] = createCube; v = v * 10;
     plane = createPlane([5 5 5], [3 4 5]);
     % draw the primitives
     figure; hold on; set(gcf, 'renderer', 'opengl');
     axis([-10 20 -10 20 -10 20]); view(3);
     drawMesh(v, f); drawPlane3d(plane);
     % compute intersection polygon
     polys = intersectPlaneMesh(plane, v, f);
     drawPolygon3d(polys, 'LineWidth', 2);

     % Intersect a torus by a set of planes, and draw the results
     % first creates a torus slightly shifted and rotated
     torus = [.5 .6 .7   30 10   3 4];
     figure('color','w');
     % convert to mesh representation
     [v, f] = torusMesh(torus, 'nTheta', 64, 'nPhi', 64);
     f = triangulateFaces(f);
     drawMesh(v, f);
     hold on; view (3); axis equal; light;
     % compute intersections with collection of planes
     xList = -50:5:50;
     polySet = cell(length(xList), 1);
     for i = 1:length(xList)
         x0 = xList(i);
         plane = createPlane([x0 .5 .5], [1 .2 .3]);
         polySet{i} = intersectPlaneMesh(plane, v, f);
     end
     % draw the resulting 3D polygons
     drawPolygon3d(polySet, 'lineWidth', 2, 'color', 'y')

     % Demonstrate ability to draw open mesh intersections
     poly = circleArcToPolyline([10 0 5 90 180], 33);
     [x, y, z] = revolutionSurface(poly, linspace(-pi, pi, 65));
     [v, f] = surfToMesh(x, y, z);
     f = triangulateFaces(f);
     plane = createPlane([0 0 0], [5 2 -4]);
     figure; hold on; axis equal; view(3);
     drawMesh(v, f, 'linestyle', 'none', 'facecolor', [0.0 0.8 0.0], 'faceAlpha', 0.7);
     drawPlane3d(plane, 'facecolor', 'm', 'faceAlpha', 0.5);
     % compute and display intersection
     [curves, closed] = intersectPlaneMesh(plane, v, f);
     drawPolyline3d(curves(~closed), 'linewidth', 2, 'color', 'b')


   See also 
     meshes3d, intersectPlanes, intersectEdgePlane




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
INTERSECTPLANEMESH Compute the polylines resulting from plane-mesh intersecti...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
isManifoldMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 600
ISMANIFOLDMESH Check whether the input mesh may be considered as manifold.

   B = isManifoldMesh(V, F)
   B = isManifoldMesh(V, E, F)
   Checks if the specified mesh is a manifold. When mesh is a manifold,
   all edges are connected to either 2 or 1 faces.

   [B, HASBORDER] = isManifoldMesh(V, E, F)
   Also checks whether the mesh contains border faces. Border faces
   contains at least one edge which is ajacent to only one face.

   Example
     [V, F] = createOctahedron;
     isManifoldMesh(V, F)
     ans =
       logical
        1

   See also 
     meshes3d, ensureManifoldMesh, trimMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 74
ISMANIFOLDMESH Check whether the input mesh may be considered as manifold.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
isPointInMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 823
ISPOINTINMESH Check if a point is inside a 3D mesh.

   B = isPointInMesh(PT, V, F)
   Check if the point PT (given as a 1-by-3 array) is inside the mesh
   defined by the vertices V and the face array F. The result is a
   boolean.

   If PT is a N-by-3 point array, the result is a N-by-1 array of logical.

   Example
     [v, f] = torusMesh([50 50 50 30 10 30 45]);
     [x, y, z] = meshgrid(5:5:100, 5:5:100, 5:5:100);
     res = false(size(x));
     res(:) = isPointInMesh([x(:) y(:) z(:)], v, f);
     figure; plot3(x(res), y(res), z(res), 'b.'); axis equal;

   Algorithm:
   The method computes the intersection with a ray starting from the
   point(s) and with a random orientation. Some errors are possible if
   rays crosses the mesh between two or three faces.

   See also 
     meshes3d, intersectLineMesh3d



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
ISPOINTINMESH Check if a point is inside a 3D mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
mergeCoplanarFaces


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1097
MERGECOPLANARFACES Merge coplanar faces of a polyhedral mesh.

   [NODES, FACES] = mergeCoplanarFaces(NODES, FACES)
   [NODES, EDGES, FACES] = mergeCoplanarFaces(NODES, EDGES, FACES)
   NODES is a set of 3D points (as a nNodes-by-3 array), 
   and FACES is one of:
   - a nFaces-by-X array containing vertex indices of each face, with each
   face having the same number of vertices,
   - a nFaces-by-1 cell array, each cell containing indices of a face.
   The function groups faces which are coplanar and contiguous, resulting
   in a "lighter" mesh. This can be useful for visualizing binary 3D
   images for example.

   FACES = mergeCoplanarFaces(..., PRECISION)
   Adjust the threshold for deciding if two faces are coplanar or
   parallel. Default value is 1e-5.

   Example
       [v, e, f] = createCube;
       f = triangulateFaces(f);
       figure; drawMesh(v, f); 
       view(3); axis equal tight;
       [v2, f2] = mergeCoplanarFaces(v, f);
       figure; drawMesh(v2, f2); 
       view(3); axis equal tight;

   See also 
       meshes3d, drawMesh, minConvexHull, triangulateFaces




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
MERGECOPLANARFACES Merge coplanar faces of a polyhedral mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
mergeMeshVertices


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 163
MERGEMESHVERTICES Merge two vertices and removes eventual degenerated faces.

   output = mergeMeshVertices(input)

   Example
   mergeMeshVertices

   See also 




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 76
MERGEMESHVERTICES Merge two vertices and removes eventual degenerated faces.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
meshAdjacencyMatrix


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 476
MESHADJACENCYMATRIX Compute adjacency matrix of a mesh from set of faces.

   ADJMAT = meshAdjacencyMatrix(FACES)
   Returns a sparse NV-by-NV matrix (NV being the largest vertex index)
   containing vertex adjacency of the mesh represented by FACES.
   FACES is either a NF-by-3, a NF-by-4 index array, or a Nf-by-1 cell
   array.

   Example
     [v f] = createCube;
     adj = meshAdjacencyMatrix(f);

   See also 
     meshes3d, triangulateFaces, smoothMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
MESHADJACENCYMATRIX Compute adjacency matrix of a mesh from set of faces.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
meshBoundary


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1063
MESHBOUNDARY Boundary of a mesh as a collection of 3D line strings.

   CURVES = meshBoundary(V, F)

   Example
     % Example 1
     % create centered icosahedron
     [v, f] = createIcosahedron;
     v(:,3) = v(:,3) - mean(v(:,3));
     % convert to simili-sphere
     [v2, f2] = subdivideMesh(v, f, 3);
     v3 = normalizeVector3d(v2);
     % clip with plane
     plane = createPlane([0 0 0], [-1 -2 3]);
     [vc, fc] = clipMeshVertices(v3, f2, plane, 'shape', 'plane');
     figure; drawMesh(vc, fc); axis equal; view(3);
     % draw mesh boundary
     curves = meshBoundary(vc, fc);
     hold on; drawPolygon3d(curves{1}, 'linewidth', 2, 'color', 'b');

     % Example 2
     mesh = readMesh('mushroom.off');
     plane = createPlane([0 0 0.7], [-1 -2 3]);
     mesh = clipMeshVertices(mesh, plane, 'shape', 'plane');
     curves = meshBoundary(mesh);
     figure; drawMesh(mesh); axis equal; view(3);
     cellfun(@(x) drawPolygon3d(x, 'linewidth', 2, 'color', 'b'), curves)

   See also 
     meshes3d, meshBoundaryEdgeIndices, meshBoundaryVertexIndices




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 67
MESHBOUNDARY Boundary of a mesh as a collection of 3D line strings.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
meshBoundaryEdgeIndices


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 868
MESHBOUNDARYEDGEINDICES Indices of boundary edges of a mesh.

   INDS = meshBoundaryVertexIndices(V, F)
   INDS = meshBoundaryVertexIndices(V, E, F)

   Example
     % create centered icosahedron
     [v, f] = createIcosahedron;
     v(:,3) = v(:,3) - mean(v(:,3));
     % convert to simili-sphere
     [v2, f2] = subdivideMesh(v, f, 3);
     v3 = normalizeVector3d(v2);
     % clip with plane
     plane = createPlane([0 0 0], [-1 -2 3]);
     [vc, fc] = clipMeshVertices(v3, f2, plane, 'shape', 'plane');
     figure; drawMesh(vc, fc); axis equal; view(3);
     % draw boundary vertices
     ec = meshEdges(vc, fc);
     inds = meshBoundaryEdgeIndices(vc, ec, fc);
     edges = [vc(ec(inds, 1), :) vc(ec(inds, 2), :)];
     hold on; drawEdge3d(edges, 'linewidth', 2, 'color', 'b');

   See also 
     meshes3d, meshBoundary, meshBoundaryVertexIndices, meshEdgeFaces



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
MESHBOUNDARYEDGEINDICES Indices of boundary edges of a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
meshBoundaryEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 874
MESHBOUNDARYEDGES Determine the boundary edges of a mesh.

   BE = meshBoundaryEdges(V, F)
   Determine for each edge of the mesh if it is a boundary edge of the 
   mesh.

   Example
     run createTrefoilKnot.m
     f2 = triangulateFaces(f2);
     % clip the mesh with a plane
     plane = createPlane([0 0 0], [-1 -2 3]);
     [v2, f2] = clipMeshVertices(v2, f2, plane, 'shape', 'plane');
     % draw the mesh
     figure('color','w'); drawMesh(v2, f2); axis equal; view(3);
     % calculate the boundary edges
     be2 = meshBoundaryEdges(v2, f2);
     % draw boundary edges
     drawEdge3d([v2(be2(:,1),:) v2(be2(:,2),:)], 'LineWidth',4,'Color','g')

   See also 
     meshes3d, meshBoundary, meshBoundaryVertexIndices, meshEdgeFaces, 
     meshBoundaryEdgeIndices

   Source:
     is_boundary_facet.m by Alec Jacobson:
       https://github.com/alecjacobson/gptoolbox



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
MESHBOUNDARYEDGES Determine the boundary edges of a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
meshBoundaryVertexIndices


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 768
MESHBOUNDARYVERTEXINDICES Indices of boundary vertices of a mesh.

   INDS = meshBoundaryVertexIndices(V, F)
   INDS = meshBoundaryVertexIndices(V, E, F)

   Example
     % create centered icosahedron
     [v, f] = createIcosahedron;
     v(:,3) = v(:,3) - mean(v(:,3));
     % convert to simili-sphere
     [v2, f2] = subdivideMesh(v, f, 3);
     v3 = normalizeVector3d(v2);
     % clip with plane
     plane = createPlane([0 0 0], [-1 -2 3]);
     [vc, fc] = clipMeshVertices(v3, f2, plane, 'shape', 'plane');
     figure; drawMesh(vc, fc); axis equal; view(3);
     % draw boundary vertices
     inds = meshBoundaryVertexIndices(vc, fc);
     hold on; drawPoint3d(vc(inds,:), 'k*');

   See also 
     meshes3d, meshBoundary, meshBoundaryEdgeIndices, meshEdgeFaces



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 65
MESHBOUNDARYVERTEXINDICES Indices of boundary vertices of a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
meshComplement


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 318
MESHCOMPLEMENT Reverse the normal of each face in the mesh.

   [V2, F2] = meshComplement(V, F)

   Example
     [v, f] = createOctahedron;
     meshVolume(v, f)
     ans =
         1.3333
     [v2, f2] = meshComplement(v, f);
     meshVolume(v2, f2)
     ans =
        -1.3333

   See also 
     meshes3d, meshVolume



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 59
MESHCOMPLEMENT Reverse the normal of each face in the mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
meshCurvatures


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2740
MESHCURVATURES Compute principal curvatures on mesh vertices.

   [C1, C2] = meshCurvatures(VERTICES, FACES)
   Computes the principal curvatures C1 and C2 for each vertex of the mesh
   defined by VERTICES and FACES.

   [C1, C2] = meshCurvatures(..., PNAME, PVALUE)
   Provides additional input arguments based on a list of name-value pairs
   of arguments. Parameter names can be:
   * 'SmoothingSteps'      (integer, default: 3) 
       Specifies the number of steps for smoothing vertex curvature
       tensors.  
   * 'Verbose'             (boolean, default: true) 
       Displays details about algorithm processing. 
   * 'ShowProgress'        (boolean, default: true) 
       Displays a text-based progress bar.

   Algorithm
   The function is adapted from the "compute_curvature" function, in the
   "toolbox_graph" from Gabriel Peyre.
   The basic idea is to define a curvature tensor for each edge, by
   assigning a minimum curvature equal to zero along the edge, and a
   maximum curvature equal to the dihedral angle across the edge.
   Averaging around the neighbors of a vertex v yields a summation formula
   over the neighbor edges to compute the curvature tensor of a vertex:
           1
   C(v) = ----     Sum       \beta(e) || e \cap A(v) || ebar ebar^t
          A(v)  {e \in A(v)}
   where:
   * A(v) is the neighborhood region, usually defined as a 'ring' around
       the vertex v
   * beta(e) is the dihedral angle between the normals of the two faces
       incident to edge e
   * || e \cap A(v) || is the length of e (more exactly, the length of the
       part of e contained within the neighborhood region
   * ebar is the normalized edge

   The curvature tensor is then decomposed into C = P D P^-1, with P
   containing main direction vectors and normal, and D being a diagonal
   matrix with the two main curvatures and zero along the diagonal.
   
   References
   * David Cohen-Steiner and Jean-Marie Morvan (2003). 
       "Restricted Delaunay triangulations and normal cycle". 
       In Proc. 19th Annual ACM Symposium on Computational Geometry, 
       pages 237-246. 
   * Pierre Alliez, David Cohen-Steiner, Olivier Devillers, Bruno Levy,
       and Mathieu Desbrun (2003). "Anisotropic Polygonal Remeshing". 
       ACM Transactions on Graphics. 
       (SIGGRAPH '2003 Conference Proceedings)
   * Mario Botsch, Leif Kobbelt, M. Pauly, P. Alliez, B. Levy (2010).
       "Polygon Mesh Processing", Taylor and Francis Group, New York.
   
   Example
     [v, f] = torusMesh;
     f2 = triangulateFaces(f);
     [c1, c2] = meshCurvatures(v, f2);
     figure; hold on; axis equal; view(3);
     drawMesh(v, f2, 'VertexColor', c1 .* c2);

   See also 
     meshes3d, drawMesh, triangulateFaces




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
MESHCURVATURES Compute principal curvatures on mesh vertices.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
meshDihedralAngles


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 960
MESHDIHEDRALANGLES Dihedral at edges of a polyhedal mesh.

   ALPHA = meshDihedralAngles(V, E, F)
   where V, E and F represent vertices, edges and faces of a mesh,
   computes the dihedral angle between the two adjacent faces of each edge
   in the mesh. ALPHA is a column array with as many rows as the number of
   edges. The i-th element of ALPHA corresponds to the i-th edge.

   Note: the function assumes that the faces are correctly oriented. The
   face vertices should be indexed counter-clockwise when considering the
   supporting plane of the face, with the outer normal oriented outwards
   of the mesh.

   Example
   [v, e, f] = createCube;
   rad2deg(meshDihedralAngles(v, e, f))
   ans = 
       90
       90
       90
       90
       90
       90
       90
       90
       90
       90
       90
       90

   See also 
   meshes3d, polyhedronMeanBreadth, trimeshMeanBreadth, dihedralAngle, meshEdgeFaces




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
MESHDIHEDRALANGLES Dihedral at edges of a polyhedal mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
meshEdgeFaces


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
ok<INUSL>



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
ok<INUSL>




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
meshEdgeLength


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 158
MESHEDGELENGTH Lengths of edges of a polygonal or polyhedral mesh.

   output = meshEdgeLength(V, E, F)

   Example
   meshEdgeLength

   See also 




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
MESHEDGELENGTH Lengths of edges of a polygonal or polyhedral mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
meshEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 189
MESHEDGES Computes array of edge vertex indices from face array.

   EDGES = meshEdges(FACES);

   Example
     meshEdges

   See also 
     meshes3d, meshEdgeFaces, meshFaceEdges



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
MESHEDGES Computes array of edge vertex indices from face array.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
meshFace


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 671
MESHFACE Return the vertex indices of a face in a mesh.

   FACE = meshFace(FACES, INDEX)
   Return the vertex indices of the i-th face in the face array. This is
   mainly an utility function that manages faces stored either as int
   array (when all faces have same number of sides) or cell array (when
   faces may have different number of edges).

   Example
     [v, f] = createCubeOctahedron;
     % some faces are squares
     meshFace(f, 1)
     ans =
          1     2     3     4
     % other are triangles
     meshFace(f, 2)
     ans =
          1     5     2

   See also 
     meshes3d, meshFaceCentroid, meshFaceNormals, meshFaceAreas



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
MESHFACE Return the vertex indices of a face in a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
meshFaceAdjacency


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 471
MESHFACEADJACENCY Compute adjacency list of face around each face.


   Example
     % Create a sample 3D mesh
     [v, e, f] = createDodecahedron;
     adjList = meshFaceAdjacency(v, e, f);
     figure; hold on; axis equal; view([100 40]);
     drawMesh(v, f);
     % draw sample face in a different color
     drawMesh(v, f(1, :), 'faceColor', 'b');
     % draw the neighbors of a sample face
     drawMesh(v, f(adjList{1}, :), 'faceColor', 'g')
     
 



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
MESHFACEADJACENCY Compute adjacency list of face around each face.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
meshFaceAreas


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 311
MESHFACEAREAS Surface area of each face of a mesh.

   areas = meshFaceAreas(vertices, faces)

   Example
     [v, f] = createOctahedron;
     meshFaceAreas(v, f)'
     ans =
         1.7321  1.7321  1.7321  1.7321  1.7321  1.7321  1.7321  1.7321

   See also 
     meshes3d, meshSurfaceArea, meshFaceCentroids



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
MESHFACEAREAS Surface area of each face of a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
meshFaceCentroids


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 662
MESHFACECENTROIDS Compute centroids of faces in a mesh.

   CENTROIDS = meshFaceCentroids(VERTICES, FACES)
   VERTICES is a set of 3D points  (as a N-by-3 array), and FACES is
   either a N-by-3 index array or a cell array of indices. The function
   computes the centroid of each face, and returns a Nf-by-3 array
   containing their coordinates.

   Example
     [v, e, f] = createIcosahedron;
     normals1 = meshFaceNormals(v, f);
     centros1 = meshFaceCentroids(v, f);
     figure; hold on; axis equal; view(3);
     drawMesh(v, f); 
     drawVector3d(centros1, normals1);


   See also 
     meshes3d, drawMesh, meshFaceNormals, meshFaceAreas, convhull




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
MESHFACECENTROIDS Compute centroids of faces in a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
meshFaceEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 283
MESHFACEEDGES Computes edge indices of each face.

   FE = meshFaceEdges(V, E, F)
   Returns a 1-by-NF cell array containing for each face, the set of edge
   indices corresponding to adjacent edges.

   Example
   meshFaceEdges

   See also 
     meshes3d, meshEdgeFaces



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
MESHFACEEDGES Computes edge indices of each face.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
meshFaceNormals


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 846
MESHFACENORMALS Compute normal vector of faces in a 3D mesh.

   NORMALS = meshFaceNormals(VERTICES, FACES)
   VERTICES is a set of 3D points (as a N-by-3 array), and FACES is either
   a N-by-3 index array or a cell array of indices. The function computes
   the normal vector of each face.
   The orientation of the normal is defined by the sign of cross product
   between vectors joining vertices 1 to 2 and 1 to 3.


   Example
     [v e f] = createIcosahedron;
     normals1 = meshFaceNormals(v, f);
     centros1 = meshFaceCentroids(v, f);
     figure; drawMesh(v, f); 
     hold on; axis equal; view(3);
     drawVector3d(centros1, normals1);

     pts = rand(50, 3);
     hull = minConvexHull(pts);
     normals2 = meshFaceNormals(pts, hull);

   See also 
   meshes3d, meshFaceCentroids, meshVertexNormals, drawFaceNormals
   drawMesh 



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
MESHFACENORMALS Compute normal vector of faces in a 3D mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
meshFaceNumber


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 533
MESHFACENUMBER Returns the number of faces in this mesh.

   NF = meshFaceNumber(V, F)
   NF = meshFaceNumber(V, E, F)
   NF = meshFaceNumber(MESH)
   Returns the number of faces in the given mesh. As the face array may be
   represented either as numeric array or as cell array of indices, this
   function is a convenient way to get the number of faces independanlty
   of the mesh representation.

   Example
     [v f] = createCube;
     meshFaceNumber(v, f)
     ans =
         6

   See also 
     meshes3d




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
MESHFACENUMBER Returns the number of faces in this mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
meshFacePolygons


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 382
MESHFACEPOLYGONS Returns the set of polygons that constitutes a mesh.

   POLYGONS = meshFacePolygons(V, F)
   POLYGONS = meshFacePolygons(MESH)

   Example
     [v f] = createCubeOctahedron;
     polygons = meshFacePolygons(v, f);
     areas = polygonArea3d(polygons);
     sum(areas)
     ans =
         18.9282

   See also 
     meshes3d, meshFace, polygonArea3d



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 69
MESHFACEPOLYGONS Returns the set of polygons that constitutes a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
meshSilhouette


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 836
MESHSILHOUETTE Compute the 2D outline of a 3D mesh on an arbitrary plane.

   ATTENTION: Very slow brute force approach! Keep the number of faces as
   low as possible.

   SILHOUETTE = meshSilhouette(MESH, PLANE)
   Calculates the silhouette (2D outline) of the MESH projected on the
   PLANE.

   SILHOUETTE = meshSilhouette(MESH) uses the x-y plane.

   SILHOUETTE = meshSilhouette(V, F, ...)

   SILHOUETTE = meshSilhouette(..., 'visu', 1) visualizes the results.
   By default the results are not visualized.

   Example:
     v = [5, 2, 6, 0, 3;  0, 2, 4, 2, 1;  -5, -6, -6, -7, -9]';
     f = [1, 2, 4; 1, 5, 4; 1, 2, 5; 2, 3, 5; 2, 4, 3; 3, 4, 5];
     sil = meshSilhouette(v, f, rand(1,9),'visu',1);
   
   See also 
     projPointOnPlane

   Source:
     Sean de Wolski - https://www.mathworks.com/matlabcentral/answers/68004



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
MESHSILHOUETTE Compute the 2D outline of a 3D mesh on an arbitrary plane.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
meshSurfaceArea


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 935
MESHSURFACEAREA Surface area of a polyhedral mesh.

   S = meshSurfaceArea(V, F)
   S = meshSurfaceArea(V, E, F)
   Computes the surface area of the mesh specified by vertex array V and
   face array F. Vertex array is a NV-by-3 array of coordinates. 
   Face array can be a NF-by-3 or NF-by-4 numeric array, or a Nf-by-1 cell
   array, containing vertex indices of each face.

   This functions iterates on faces, extract vertices of the current face,
   and computes the sum of face areas.

   This function assumes faces are coplanar and convex. If faces are all
   triangular, the function "trimeshSurfaceArea" should be more efficient.


   Example
     % compute the surface of a unit cube (should be equal to 6)
     [v f] = createCube;
     meshSurfaceArea(v, f)
     ans = 
         6

   See also 
     meshes3d, trimeshSurfaceArea, meshVolume, meshFaceAreas,
     meshFacePolygons, polygonArea3d




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
MESHSURFACEAREA Surface area of a polyhedral mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
meshVertexClustering


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 976
MESHVERTEXCLUSTERING Simplifies a mesh using vertex clustering.

   [V2, F2] = meshVertexClustering(V, F, SPACING)
   [V2, F2] = meshVertexClustering(MESH, SPACING)
   MESH2 = meshVertexClustering(...)

   Simplifies a mesh using vertex clustering. Input mesh is specified
   either by a pair V, F containing the vertex coordinates and the faces
   informations, or by a structure with fields 'vertices' and 'faces'.

   The SPACING input defines the size of the grid. It can be either a
   scalar (uniform grid) or a 1-by-3 row vector. 

   The output is specified either in two outputs, or in a structure with
   fields 'vertices' and 'faces'.

   Example
     [x, y, z]  = meshgrid(1:100, 1:100, 1:100);
     img = hypot3(x-51.12, y-52.23, z-53.34);
     [faces, vertices] = isosurface(img, 45);
     [v2, f2] = meshVertexClustering(vertices, faces, 10);
     figure; axis equal; axis([0 100 0 100 0 100]);
     drawMesh(v2, f2);

   See also 
     reducepatch, smoothMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 63
MESHVERTEXCLUSTERING Simplifies a mesh using vertex clustering.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
meshVertexNormals


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 598
MESHVERTEXNORMALS Compute normals to a mesh vertices.

   N = meshVertexNormals(V, F)
   Computes vertex normals of the mesh given by vertices V and F. 
   V is a vertex array with 3 columns, F is either a NF-by-3 or NF-by-4
   index array, or a cell array with NF elements.

   Example
     % Draw the vertex normals of a sphere
     s = [10 20 30 20];
     [v f] = sphereMesh(s);
     figure; drawMesh(v, f);
     view(3);axis equal; light; lighting gouraud;
     normals = meshVertexNormals(v, f);
     drawVector3d(v, normals*2);

   See also 
     meshes3d, meshFaceNormals, triangulateFaces




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
MESHVERTEXNORMALS Compute normals to a mesh vertices.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
meshVolume


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 923
MESHVOLUME (Signed) volume of the space enclosed by a polygonal mesh.

   V = meshVolume(VERTS, FACES)
   Computes the volume of the space enclosed by the polygonal mesh
   represented by vertices VERTS (as a Nv-by-3 array of cooridnates) and
   the array of faces FACES (either as a Nf-by-3 array of vertex indices,
   or as a cell array of arrays of vertex indices).

   The volume is computed as the sum of the signed volumes of tetrahedra
   formed by triangular faces and the centroid of the mesh. Faces need to
   be oriented such that normal points outwards the mesh. See:
   http://stackoverflow.com/questions/1838401/general-formula-to-calculate-polyhedron-volume

   Example
     % computes the volume of a unit cube (should be equal to 1...)
     [v f] = createCube;
     meshVolume(v, f)
     ans = 
         1

   See also 
   meshes3d, meshSurfaceArea, tetrahedronVolume, meshComplement



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 69
MESHVOLUME (Signed) volume of the space enclosed by a polygonal mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
meshVoronoiDiagram


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1720
MESHVORONOIDIAGRAM Voronoi Diagram on the surface of a polygonal mesh.

   REGIONS = meshVoronoiDiagram(V, F, GERM_INDS)
   Computes the region associated to each vertex of the input mesh (V,F),
   i.e. the index of the germ closest to the vertex.
   V is a NV-by-3 array of vertx coordinates, and F is a NF-by-3 array
   containing vertex indices of each face.
   IGERMS is an array of vertex indices.
   REGIONS is a column vector with as many rows as the number of vertices,
   containing for each vertex the index of the closest germ. 
   The regions are computed by propagating distances along edges.
   
   [REGIONS, DISTANCES] = meshVoronoiDiagram(V, F, GERM_INDS)
   Also returns the (geodesic) distance from each vertex to the closest
   germ. 
   

   Example
     % Create a triangular mesh based on an icosahedron shape
     [v, f] = createIcosahedron; v = v - mean(v); 
     [v, f] = subdivideMesh(v, f, 10); v = normalizeVector3d(v);
     figure; hold on; axis equal; view(3);
     drawMesh(v, f, 'faceColor', [.7 .7 .7]);
     % generate germs within the mesh (identify with indices)
     nGerms = 10; 
     inds = randperm(size(v, 1), nGerms);
     drawPoint3d(v(inds,:), 'bo');
     % Compute Voronoi Diagram
     [regions, distances] = meshVoronoiDiagram(v, f, inds);
     % Display regions
     figure; hold on; axis equal; view(3);
     cmap = jet(nGerms);
     patch('Vertices', v, 'Faces', f, 'FaceVertexCData', cmap(regions, :), 'FaceColor', 'interp', 'LineStyle', 'none');
     % Display distance maps
     figure; hold on; axis equal; view(3);
     patch('Vertices', v, 'Faces', f, 'FaceVertexCData', distances, 'FaceColor', 'interp', 'LineStyle', 'none');

   See also 
     meshes3d, drawMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 70
MESHVORONOIDIAGRAM Voronoi Diagram on the surface of a polygonal mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
minConvexHull


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1195
MINCONVEXHULL Return the unique minimal convex hull of a set of 3D points.

   FACES = minConvexHull(PTS)
   NODES is a set of 3D points  (as a Nx3 array). The function computes
   the convex hull, and merge contiguous coplanar faces. The result is a
   set of polygonal faces, such that there are no coplanar faces.
   FACES is a cell array, each cell containing the vector of indices of
   nodes given in NODES for the corresponding face.

   FACES = minConvexHull(PTS, PRECISION)
   Adjust the threshold for deciding if two faces are coplanar or
   parallel. Default value is 1e-14.

   Example
     % extract square faces from a cube
     [n, e, f] = createCube;
     f2 = minConvexHull(n);
     drawMesh(n, f2);

     % Subdivides and smooths a mesh rpresenting a cube
     [n, e, f] = createCube;
     [n2, f2] = subdivideMesh(n, triangulateFaces(f), 4);
     [n3, f3] = smoothMesh(n2, f2);
     figure; drawMesh(n3, f3);
     axis equal; view(3);
     % merge coplanar faces, making apparent the faces of the original cube
     f4 = minConvexHull(n3);
     figure; drawMesh(n3, f4);
     axis equal; view(3);


   See also 
   meshes3d, mergeCoplanarFaces, drawMesh, convhull, convhulln




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 74
MINCONVEXHULL Return the unique minimal convex hull of a set of 3D points.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
polyhedra


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1131
POLYHEDRA Index of classical polyhedral meshes.
   
   Polyhedra are specific meshes, with additional assumptions:
   * the set of faces is assumed to enclose a single 3D domain
   * each face has a neighbor face for each edge
   * some functions also assume that normals of all faces point outwards 

   Most polyhedron creation functions follow the patterns:
   * [V, F] = createXXX();     % returns vertex and face arrays
   * [V, E, F] = createXXX();  % returns also edge array
   * M = createXXX();          % return a data structure with 'vertices',
                               % 'edges' and 'faces' fields.

   Example
   % create a soccer ball mesh and display it
   [n, f] = createSoccerBall;
   drawMesh(n, f, 'faceColor', 'g', 'linewidth', 2);
   axis equal;

   See also 
   meshes3d
   createCube, createCubeOctahedron, createIcosahedron, createOctahedron
   createRhombododecahedron, createTetrahedron, createTetrakaidecahedron
   createDodecahedron, createSoccerBall, createMengerSponge
   steinerPolytope, minConvexHull, drawPolyhedron
   polyhedronNormalAngle, polyhedronMeanBreadth




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
POLYHEDRA Index of classical polyhedral meshes.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
polyhedronCentroid


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
ok<INUSD>



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
ok<INUSD>




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
polyhedronMeanBreadth


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1533
POLYHEDRONMEANBREADTH Mean breadth of a convex polyhedron.

   BREADTH = polyhedronMeanBreadth(V, E, F)
   Return the mean breadth (average of polyhedron caliper diameter over
   all direction) of a convex polyhedron.

   The mean breadth is computed using the sum, over the edges of the
   polyhedron, of the edge dihedral angles multiplied by the edge length, 
   the final sum being divided by (4*PI).

   Note: the function assumes that the faces are correctly oriented. The
   face vertices should be indexed counter-clockwise when considering the
   supporting plane of the plane, with the outer normal oriented outwards
   of the polyhedron.

   Typical values for classical polyhedra are:
     cube side a               breadth = (3/2)*a
     cuboid sides a, b, c      breadth = (a+b+c)/2
     tetrahedron side a        breadth = 0.9123*a
     octaedron side a          beradth = 1.175*a
     dodecahedron, side a      breadth = 15*arctan(2)*a/(2*pi)
     icosaehdron, side a       breadth = 15*arcsin(2/3)*a/(2*pi)

   Example
   [v e f] = createCube;
   polyhedronMeanBreadth(v, e, f)
   ans = 
       1.5

   See also 
   meshes3d, meshEdgeFaces, meshDihedralAngles, checkMeshAdjacentFaces
   trimeshMeanBreadth

   References
   Stoyan D., Kendall W.S., Mecke J. (1995) "Stochastic Geometry and its
       Applications", John Wiley and Sons, p. 26
   Ohser, J., Muescklich, F. (2000) "Statistical Analysis of
       Microstructures in Materials Sciences", John Wiley and Sons, p.352



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
POLYHEDRONMEANBREADTH Mean breadth of a convex polyhedron.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
polyhedronNormalAngle


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 953
POLYHEDRONNORMALANGLE Compute normal angle at a vertex of a 3D polyhedron.

   THETA = polyhedraNormalAngle(NODES, EDGES, FACES, IND);
   THETA = polyhedraNormalAngle(NODES, FACES, IND);
   where NODES is a set of 3D points, and FACES a set of faces, whose
   elements are indices to NODES array, compute the normal angle at the
   vertex whose index is given by IND.

   THETA = polyhedraNormalAngle(GRAPH, IND);
   Uses a graph structure for definineg polyhedron. GRAPH structure should
   contain at least two fields : 'nodes' and 'faces'.

   Example :
   % create a simple (irregular) tetrahedra
   nodes = [0 0 0;1 0 0;0 1 0;0 0 1];
   faces = [1 2 3;1 2 4;1 3 4;2 3 4];
   % compute normal angle at each vertex
   theta = polyhedronNormalAngle(nodes, faces, 1:size(nodes, 1));
   % sum of normal angles should be equal to 4*pi :
   sum(theta)

   Note: works only for polyhedra with convex faces!

   See also 
   polyhedra, polygon3dNormalAngle



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 74
POLYHEDRONNORMALANGLE Compute normal angle at a vertex of a 3D polyhedron.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
polyhedronSlice


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 527
POLYHEDRONSLICE Intersect a convex polyhedron with a plane.

   SLICE = polyhedronSlice(NODES, FACES, PLANE)
   NODES: a Nx3 array
   FACES: either a cell array or a Nf*3 or Nf*4 array
   PLANE: a plane representation [x0 y0 z0 dx1 dy1 dz1 dx2 dy2 dz2].
   return the intersection polygon of the polyhedra with the plane, in the
   form of a set of ordered points.

   Works only for convex polyhedra.

   Example
   polyhedronSlice

   See also 
   polyhedra, clipConvexPolyhedronByPlane, intersectPlaneMesh




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 59
POLYHEDRONSLICE Intersect a convex polyhedron with a plane.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
readMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 865
READMESH Read a 3D mesh by inferring format from file name.

   Usage:
   [V, F] = readMesh(FILENAME)
   Read the data stored in file FILENAME and return the vertex and face
   arrays as NV-by-3 array and NF-by-N array respectively, where NV is the
   number of vertices and NF is the number of faces.

   MESH = readMesh(FILENAME)
   Read the data stored in file FILENAME and return the mesh into a struct
   with fields 'vertices' and 'faces'.
   The struct also comprises two fields "name" and "fileName":
   * "name" corresponds to the base name of the file (without path and
       extension)
   * "filePath" corresponds to the full (relative) path name of the file. 

   Example
     mesh = readMesh('apple.ply');
     figure; drawMesh(mesh);
     view([180 -70]); axis equal;

   See also 
     meshes3d, writeMesh, readMesh_off, readMesh_ply, readMesh_stl




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 59
READMESH Read a 3D mesh by inferring format from file name.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
readMesh_obj


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 591
READMESH_OBJ Read mesh data stored in OBJ format.

   MESH = readMesh_obj(FILENAME)
   Read the data stored in file FILENAME and return the mesh into a struct
   with fields 'vertices' and 'faces'.

   Example
     mesh = readMesh_obj('teapot.obj');
     figure; drawMesh(mesh, 'facecolor', [.5 .5 .5]);
     axis equal; light;

   References
   Adapted from Bernard Abayowa (2022). readObj
   (https://www.mathworks.com/matlabcentral/fileexchange/18957-readobj),
   MATLAB Central File Exchange. Retrieved September 8, 2022.  

   See also 
     meshes3d, readMesh, readMesh_off, drawMesh




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
READMESH_OBJ Read mesh data stored in OBJ format.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
readMesh_off


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 712
READMESH_OFF Read mesh data stored in OFF format.

   [VERTICES, FACES] = readMesh_off(FILENAME)
   Read the data stored in file FILENAME and return the vertex and face
   arrays as NV-by-3 array and NF-by-N array respectively, where NV is the
   number of vertices and NF is the number of faces.

   MESH = readMesh_off(FILENAME)
   Read the data stored in file FILENAME and return the mesh into a struct
   with fields 'vertices' and 'faces'.

   Example
     [v, f] = readMesh_off('mushroom.off');
     figure; drawMesh(v, f, 'faceColor', [0 1 0], 'edgeColor', 'none')
     view([5 80]); light; lighting gouraud

   See also 
     meshes3d, readMesh, writeMesh_off, readMesh_obj, drawMesh




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
READMESH_OFF Read mesh data stored in OFF format.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
readMesh_ply


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 723
READMESH_PLY Read mesh data stored in PLY (Stanford triangle) format.

   [V, F] = readMesh_ply(FNAME)
   V is a NV-by-3 numeric array containing vertex coordinates,
   F is a NF-by-3 or NF-by-4 array containg vertex indices of each face.

   MESH = readMesh_ply(FNAME)
   Returns mesh vertex and face information into a single structure with
   fields 'vertices' and 'faces'.

   Example
     [v, f] = readMesh_ply('bunny_F1k.ply');
     trisurf(f, v(:,1),v(:,2),v(:,3));
     colormap(gray); axis equal;

   References
   Adapted from Gabriel Peyré's "read_ply" function, that is was a wrapper
   for the "plyread" function written by Pascal Getreuer.

   See also 
       meshes3d, readMesh, readMesh_off, readMesh_stl



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 69
READMESH_PLY Read mesh data stored in PLY (Stanford triangle) format.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
readMesh_stl


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 454
READMESH_STL Read mesh data stored in STL format.

   [VERTICES, FACES] = readMesh_stl(FNAME)

   MESH = readMesh_stl(FNAME)

   See also 
     meshes3d, readMesh, readMesh_off, readMesh_ply, writeMesh_stl

   Source
     Functions of the stlTools toolbox by Pau Micó are used for STL files
     in ASCII format:
     https://mathworks.com/matlabcentral/fileexchange/51200-stltools
     MATLAB's build-in stlread is used for STL files in binary format.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
READMESH_STL Read mesh data stored in STL format.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
removeDuplicateFaces


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 280
REMOVEDUPLICATEFACES Remove duplicate faces in a face array.

   [V, F] = removeDuplicateFaces(V, F)

   Example
     faces = [1 2 3;2 3 4;3 4 5;2 3 4];
     removeDuplicateFaces(faces)
     ans =
         1 2 3
         2 3 4
         2 3 5

   See also 
     ensureManifoldMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
REMOVEDUPLICATEFACES Remove duplicate faces in a face array.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
removeDuplicateVertices


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1178
REMOVEDUPLICATEVERTICES Remove duplicate vertices of a mesh.

   [V2, F2] = removeDuplicateVertices(V, F) 
   Remove duplicate vertices of a mesh defined by the vertices V and 
   faces F.

   [V2, F2] = removeDuplicateVertices(V, F, TOL)
   Remove duplicate vertices with the tolerance TOL:
       TOL = 0     -> Exact match
       TOL = 1e-1  -> Match up to first decimal
       TOL = 1     -> Integer match

   [VIDX, FIDX] = removeDuplicateVertices(V, F, TOL, 'indexOutput', true)
   Gives the indices instead of the final mesh. This means:
       V2 = V(VIDX,:)
       F2 = FIDX(F)
       V = V2(FIDX,:)

   Example
     v = [6-1e-6,0,-5;4,2,-2*pi;0,2,-7;6,0,-5;3,1,-9;0,2,-7;...
         6,0,-5+1e-6;4,2,-2*pi;3,1,-9;4,2,-2*pi;6,4,-6;3,1,-9;...
         4,2,-2*pi;0,2,-7;6,4,-6;6,4,-6;0,2,-7;3,1,-9];
     f = reshape(1:18,3,6)';
     [v, f] = removeDuplicateVertices(v, f);
   
   See also 
     trimMesh, removeDuplicateFaces, removeUnreferencedVertices

   Source
     patchslim.m by Francis Esmonde-White:
       https://mathworks.com/matlabcentral/fileexchange/29986
     remove_duplicate_vertices.m by Alec Jacobson:
       https://github.com/alecjacobson/gptoolbox



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
REMOVEDUPLICATEVERTICES Remove duplicate vertices of a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
removeInvalidBorderFaces


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 234
REMOVEINVALIDBORDERFACES Remove faces whose edges are connected to 3, 3, and 1 faces.

   [V2, F2] = removeInvalidBorderFaces(V, F)

   Example
   removeInvalidBorderFaces

   See also 
     isManifoldMesh, collapseEdgesWithManyFaces



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
REMOVEINVALIDBORDERFACES Remove faces whose edges are connected to 3, 3, and ...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
removeMeshEars


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 410
REMOVEMESHEARS Remove vertices that are connected to only one face.

   [V, F] = removeMeshEars(V, F)
   [V, F] = removeMeshEars(MESH)
   Remove vertices that are connected to only one face. This removes also
   "pending" faces.
   Note that if the mesh has boundary, this may remove some regular faces
   located on the boundary.

   Example
   removeMeshEars

   See also 
     meshes3d, ensureManifoldMesh




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 67
REMOVEMESHEARS Remove vertices that are connected to only one face.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
removeMeshFaces


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1112
REMOVEMESHFACES Remove faces from a mesh by face indices.
   [V2, F2] = removeMeshFaces(V, F, FI) removes faces from the mesh by
   the face indices FI into faces F of the mesh. The mesh is represented 
   by the vertex array V and the face array F. The result is the new set 
   of vertices V2 and faces F2 without the faces indexed by FI. FI can be
   either a linear or a logical index.

   [V2, F2] = removeMeshFaces(MESH, FI) with the struct MESH containing 
   the fields "vertices" (V) and "faces" (F)
   
   MESH2 = removeMeshFaces(V, F, FI) with the struct MESH2 containing the
   fields "vertices" (V2) and "faces" (F2)
   
   MESH2 = removeMeshFaces(MESH, FI) with the structs MESH and MESH2 
   containing the fields "vertices" (V, V2) and "faces" (F, F2)
   
   Example
     [v, f] = createSoccerBall;
     f = triangulateFaces(f);
     fI = true(length(f),1);
     fI(1:length(f)/2) = false;
     [v2, f2] = removeMeshFaces(v, f, fI);
     drawMesh(v, f, 'faceColor', 'none', 'faceAlpha', .2);
     drawMesh(v2, f2, 'faceAlpha', .7);
     view(3); axis equal
   
   See also 
   meshes3d, drawMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
REMOVEMESHFACES Remove faces from a mesh by face indices.
   [V2, F2] = remov...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
removeMeshVertices


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 590
REMOVEMESHVERTICES Remove vertices and associated faces from a mesh.

   [V2, F2] = removeMeshVertices(VERTS, FACES, VERTINDS)
   Removes the vertices specified by the vertex indices VERTINDS, and
   remove the faces containing one of the removed vertices.

   Example
     % remove some vertices from a soccerball polyhedron
     [v, f] = createSoccerBall; 
     plane = createPlane([.6 0 0], [1 0 0]);
     indAbove = find(~isBelowPlane(v, plane));
     [v2, f2] = removeMeshVertices(v, f, indAbove);
     drawMesh(v2, f2);
     axis equal; hold on;

   See also 
     meshes3d, trimMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 68
REMOVEMESHVERTICES Remove vertices and associated faces from a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
removeUnreferencedVertices


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 829
REMOVEUNREFERENCEDVERTICES Remove unreferenced vertices of a mesh.

   [V2, F2] = removeUnreferencedVertices(V, F)
   Remove unreferenced/unindexed vertices of a mesh defined by the
   vertices V and faces F.

   [VIDX, FIDX] = removeUnreferencedVertices(V, F, 'indexOutput', true)
   Gives the indices instead of the final mesh. This means:
       V2 = V(VIDX,:)
       F2 = FIDX(F)

   Example:
     [v, f] = createCube;
     % Add unreferenced vertices
     for idx = [2, 5, 7]
         v = [v(1:idx,:); rand(1,3); v(idx+1:end,:)];
         f(find(f>idx))=f(find(f>idx))+1; %#ok<FNDSB> 
     end
     [v2, f2] = removeUnreferencedVertices(v, f);

   See also 
     trimMesh, removeDuplicateFaces, removeDuplicateVertices

   Source
     remove_unreferenced.m by Alec Jacobson:
       https://github.com/alecjacobson/gptoolbox



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
REMOVEUNREFERENCEDVERTICES Remove unreferenced vertices of a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
smoothMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 954
SMOOTHMESH Smooth mesh by replacing each vertex by the average of its neighbors.

   V2 = smoothMesh(V, F)
   [V2, F2] = smoothMesh(V, F)
   Performs smoothing of the values given in V, by using adjacency
   information given in F. 
   V is a numeric array representing either vertex coordinate, or value
   field associated to each vertex. F is an array of faces, given either
   as a NF-by-3 or NF-by-4 numeric array, or as a cell array. 
   Artifact adjacencies are added if faces have more than 4 vertices.

   ... = smoothMesh(V, F, NITER)
   Repeat the smoothing procedure NITER times. This is equivalent to
   calling the smoothMesh function NITER times.


   Example
     [v f] = torusMesh([50 50 50 30 10 30 45]);
     v = v + randn(size(v));
     [v2 f] = smoothMesh(v, f, 3);
     figure; drawMesh(v2, f);
     l = light; lighting gouraud

   See also 
     meshes3d, meshAdjacencyMatrix, triangulateFaces, drawMesh




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
SMOOTHMESH Smooth mesh by replacing each vertex by the average of its neighbo...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
smoothMeshFunction


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
ok<INUSL>



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
ok<INUSL>




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
sphereMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 666
SPHEREMESH Create a 3D mesh representing a sphere.

   [V, F] = sphereMesh(S)
   Creates a 3D mesh representing the sphere S given by [xc yc zy r].

   [V, F] = sphereMesh();
   Assumes sphere is the unit sphere centered at the origin.

   [V, F] = sphereMesh(S, 'nTheta', NT, 'nPhi', NP);
   Specifies the number of discretisation steps for the meridians and the
   parallels. Default values are nTheta = 16 and nPhi = 32.


   Example
     s = [10 20 30 40];
     [v, f] = sphereMesh(s);
     drawMesh(v, f);
     view(3); axis equal; light; lighting gouraud;

   See also 
     meshes3d, drawSphere, ellipsoidMesh, cylinderMesh, surfToMesh




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
SPHEREMESH Create a 3D mesh representing a sphere.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
splitMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1281
SPLITMESH Return the connected components of a mesh.

   MESHES = splitMesh(VERTICES, FACES) returns the connected components of
   the mesh defined by vertices and faces as a struct array with the  
   fields vertices and faces sorted by increasing vertex number

   MESHES = splitMesh(MESH) with the vertices-faces-struct MESH is also
   possible
   
   ... = splitMesh(..., 'mostVertices') returns only the component with
   the most vertices. Other options are 'all' (default),
   'maxBoundingBox' that returns the component with the largest bounding 
   box, and 'maxVolume' returns the component with the largest volume.


   Example
     [v1, f1] = boxToMesh([1 0 -1 0 -1 0]);
     [v2, f2] = boxToMesh([-1 0 1 0 -1 0]);
     [v3, f3] = createSoccerBall;
     f1 = triangulateFaces(f1);
     f2 = triangulateFaces(f2);
     f3 = triangulateFaces(f3);
     [vertices, faces] = concatenateMeshes(v1, f1, v3, f3, v2, f2);
     meshes = splitMesh(vertices, faces);
     figure('color','w'); view(3); axis equal
     cmap=hsv(length(meshes));
     for m=1:length(meshes)
         drawMesh(meshes(m), cmap(m,:))
     end

   See also 
     concatenateMeshes

   Source
     Local functions are part of the gptoolbox of Alec Jacobson
     https://github.com/alecjacobson/gptoolbox



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
SPLITMESH Return the connected components of a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
steinerPolytope


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 557
STEINERPOLYTOPE Create a steiner polytope from a set of vectors.

   [VERTICES FACES] = steinerPolygon(VECTORS)
   Creates the Steiner polytope defined by the set of vectors VECTORS.

   Example
     % Creates and display a planar Steiner polytope (ie, a polygon)
     [v f] = steinerPolytope([1 0;0 1;1 1]);
     fillPolygon(v);

     % Creates and display a 3D Steiner polytope 
     [v f] = steinerPolytope([1 0 0;0 1 0;0 0 1;1 1 1]);
     drawMesh(v, f);
     view(3); axis vis3d

   See also 
   meshes3d, drawMesh, steinerPolygon, mergeCoplanarFaces




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
STEINERPOLYTOPE Create a steiner polytope from a set of vectors.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
subdivideMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 402
SUBDIVIDEMESH Subdivides each face of the mesh.

   [V2 F2] = subdivideMesh(V, F, N)
   Subdivides the mesh specified by (V,F) such that each face F is divided
   into N^2 smaller faces.

   Example
     [v, f] = createOctahedron;
     figure; drawMesh(v, f); view(3);
     [v2, f2] = subdivideMesh(v, f, 4);
     figure; drawMesh(v2, f2); view(3)

   See also 
     meshes3d, drawMesh




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
SUBDIVIDEMESH Subdivides each face of the mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
surfToMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 757
SURFTOMESH Convert surface grids into face-vertex mesh.

   [V, F] = surfToMesh(X, Y)
   [V, F] = surfToMesh(X, Y, Z)
   Converts the surface grid given by two or three coordinate arrays into
   a face-vertex quad mesh.

   Example
     % transform a surface into a mesh
     [X, Y] = meshgrid(-2:.2:2, -2:.2:2);                                
     Z = X .* exp(-X.^2 - Y.^2);
     [V, F] = surfToMesh(X, Y, Z);
     figure;
     drawMesh(V, F); view(3);

     % Transform surface of a cylinder as a mesh
     [x, y, z] = cylinder(5*ones(1, 10));
     [v, f] = surfToMesh(x, y, z, 'xPeriodic', true);
     figure;
     drawMesh(v, f);
     view(3); axis equal;

   See also 
     meshes3d, meshgrid, drawMesh, torusMesh, sphereMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
SURFTOMESH Convert surface grids into face-vertex mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
tetrahedronVolume


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 473
TETRAHEDRONVOLUME Signed volume of a tetrahedron.

   VOL = tetrahedronVolume(TETRA)
   Comptues the siged volume of the tetrahedron TETRA defined by a 4-by-4
   array representing the polyhedron vertices.

   Example
     vi = [0 0 0;1 0 0;0 1 0;0 0 1];
     tetrahedronVolume(vi)
     ans = 
         0.1667

     [V F] = createTetrahedron;
     tetrahedronVolume(V)
     ans = 
         -.3333

   See also 
   meshes3d, createTetrahedron, meshVolume



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
TETRAHEDRONVOLUME Signed volume of a tetrahedron.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
torusMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 934
TORUSMESH Create a 3D mesh representing a torus.

   [V, F] = torusMesh(TORUS)
   Converts the torus in TORUS into a face-vertex quadrangular mesh.
   TORUS is given by [XC YC ZY R1 R2 THETA PHI]
   where (XC YZ ZC) is the center of the torus, R1 is the main radius, R2
   is the radius of the torus section, and (THETA PHI) is the angle of the
   torus normal vector (both in degrees).

   [V, F] = torusMesh(TORUS, 'nTheta', NT, 'nPhi', NP)
   Creates a mesh using NP circles, each circle being discretized with NT
   vertices. Default are 60 for both parameters.

   [V, F] = torusMesh()
   Creates a mesh representing a default torus.

   Example
     [v, f] = torusMesh([50 50 50  30 10  30 45]);
     figure; drawMesh(v, f, 'linestyle', 'none');
     view(3); axis equal; 
     lighting gouraud; light;


   See also 
     meshes3d, drawTorus, revolutionSurface, cylinderMesh, sphereMesh
     drawMesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
TORUSMESH Create a 3D mesh representing a torus.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
transformMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 455
TRANSFORMMESH Applies a 3D affine transform to a mesh.

   MESH2 = transformMesh(MESH1, TRANSFO)
   MESH2 = transformMesh(VERTICES, FACES, TRANSFO)
   [V2, F2] = transformMesh(...)

   Example
     mesh1 = createOctahedron;
     transfo = eulerAnglesToRotation3d([30 20 10]);
     mesh2 = transformMesh(mesh1, transfo);
     figure; axis equal; hold on; drawMesh(mesh2, 'faceColor', 'g'); view(3);

   See also 
     meshes3d, transformPoint3d, drawMesh




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
TRANSFORMMESH Applies a 3D affine transform to a mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
triangulateCurvePair


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 708
TRIANGULATECURVEPAIR Compute triangulation between a pair of 3D open curves.

   [V, F] = testTriangulateCurvePair(CURVE1, CURVE2)

   Example
     % triangulate a surface patch between two open curves
     % create two sample curves
     t = linspace(0, 2*pi, 100);
     curve1 = [linspace(0, 10, 100)' 5 * sin(t') zeros(100,1)];
     curve2 = [linspace(0, 10, 100)' 2 * sin(t') 2*ones(100,1)];
     figure; hold on;
     drawPolyline3d(curve1, 'b');
     drawPolyline3d(curve2, 'g');
     view(3); axis equal;
     [v, f] = triangulateCurvePair(curve1, curve2);
     figure; drawMesh(v, f, 'linestyle', 'none');
     view(3); axis equal

   See also 
     meshes3D, triangulatePolygonPair, meshSurfaceArea



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 76
TRIANGULATECURVEPAIR Compute triangulation between a pair of 3D open curves.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
triangulateFaces


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1260
TRIANGULATEFACES Convert face array to an array of triangular faces.

   TRI = triangulateFaces(FACES)
   Returns a 3-columns array of indices, based on the data stored in the
   argument FACES:
   - if FACES is a N-by-3 array, returns the same array
   - if FACES is a N-by-4 array, returns an array with 2*N rows and 3
       columns, splitting each square into 2 triangles (uses first and
       third vertex of each square as diagonal).
   - if FACES is a cell array, split each face into a set of triangles,
       and returns the union of all triangles. Faces are assumed to be
       convex.

   [TRI, INDS] = triangulateFaces(FACES)
   Also returns original face index of each new triangular face. INDS has
   the same number of rows as TRI, and has values between 1 and the
   number of rows of the original FACES array.


   Example
     % create a basic shape
     [n, e, f] = createCubeOctahedron;
     % draw with plain faces
     figure; hold on; axis equal; view(3);
     drawMesh(n, f);
     % draw as a triangulation
     tri = triangulateFaces(f);
     figure; hold on; axis equal; view(3);
     drawMesh(n, tri, 'facecolor', 'r'); 

   See also 
     meshes3d, triangulateMesh, drawMesh, mergeCoplanarFaces




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 68
TRIANGULATEFACES Convert face array to an array of triangular faces.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
triangulateMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1213
TRIANGULATEMESH Convert a non-triangle mesh into a triangle mesh.

   [V2, F2] = triangulateMesh(V, F)
   Convert the mesh represented by vertices V and faces F into a triangle
   mesh. V is N-by-3 numeric array containing vertex coordinates. F is an
   array representing faces: either a N-by-4 or N-by-3 numeric array, or a
   cell array for meshes with non homogeneous face vertex counts.
   The result is a mesh with same vertices (V == F), and F2 represented as
   a N-by-3 numeric array. If the input mesh is already a triangular mesh,
   the result is the same as the input.

   [V2, F2] = triangulateMesh(MESH)
   Specifies the mesh as a structure with at least two fields 'vertices'
   and 'faces'. 

   MESH2 = triangulateMesh(...)
   Returns the result as a mesh data structure with two fields 'vertices'
   and 'faces'. 

   Example
     % create a basic shape
     [v, f] = createCubeOctahedron;
     % draw with plain faces
     figure; hold on; axis equal; view(3);
     drawMesh(v, f);
     % draw as a triangulation
     [v2, f2] = triangulateMesh(v, f);
     figure; hold on; axis equal; view(3);
     drawMesh(v2, f2, 'facecolor', 'r');

   See also 
     meshes3d, triangulateFaces, drawMesh




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 65
TRIANGULATEMESH Convert a non-triangle mesh into a triangle mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
triangulatePolygonPair


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1395
TRIANGULATEPOLYGONPAIR Compute triangulation between a pair of 3D closed curves.

   [V, F] = triangulatePolygonPair(POLY1, POLY2)

   [V, F] = triangulatePolygonPair(..., 'recenter', FLAG)
   Where FLAG is a boolean, specifies whether the second curve should be
   translated to have the same centroid as the first curve. This can
   improve mathcing of vertices. Default is true.


   Example
     % triangulate a surface patch between two ellipses
     % create two sample curves
     poly1 = ellipseToPolygon([50 50 40 20 0], 36);
     poly2 = ellipseToPolygon([50 50 40 20 60], 36);
     poly1 = poly1(1:end-1,:);
     poly2 = poly2(1:end-1,:);
     % transform to 3D polygons / curves
     curve1 = [poly1 10*ones(size(poly1, 1), 1)];
     curve2 = [poly2 20*ones(size(poly2, 1), 1)];
     % draw as 3D curves
     figure(1); clf; hold on;
     drawPolygon3d(curve1, 'b'); drawPoint3d(curve1, 'bo');
     drawPolygon3d(curve2, 'g'); drawPoint3d(curve2, 'go');
     view(3); axis equal;
     [vertices, faces] = triangulatePolygonPair(curve1, curve2);
     % display the resulting mesh
     figure(2); clf; hold on;
     drawMesh(vertices, faces);
     drawPolygon3d(curve1, 'color', 'b', 'linewidth', 2);
     drawPolygon3d(curve2, 'color', 'g', 'linewidth', 2);
     view(3); axis equal;

   See also 
     meshes3D, triangulatePolygonPair3d, triangulateCurvePair,
     meshSurfaceArea 




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
TRIANGULATEPOLYGONPAIR Compute triangulation between a pair of 3D closed curv...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
triangulatePolygonPair3d


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1865
TRIANGULATEPOLYGONPAIR3D Compute a triangulation between a pair of 3D polygons.

   TRI = triangulatePolygonPair3d(POLY1, POLY2)
   Computes a triangulation between vertices of the two input polygons.
   Each triangle refer to one vertex of either POLY1 or POLY2, and two
   vertices of the other polygon. Vertex indices correspond to the
   concatenation of the two polygons. They range from 1 to NV1+NV2.
   This version minimizes the surface area of the reconstructed surface.

   [TRI, WEIGHT] = triangulatePolygonPair3d(POLY1, POLY2)
   Also returns the optimal weigth of the reconstruction, corresponding to
   the surface area of the triangulation.
   
   Example
     % triangulate a surface patch between two ellipses
     % create two sample curves
     poly1 = ellipseToPolygon([50 50 40 20 0], 36);
     poly2 = ellipseToPolygon([50 50 40 20 60], 36);
     poly1 = poly1(1:end-1,:);
     poly2 = poly2(1:end-1,:);
     % transform to 3D polygons / curves
     curve1 = [poly1 10*ones(size(poly1, 1), 1)];
     curve2 = [poly2 20*ones(size(poly2, 1), 1)];
     % draw as 3D curves
     figure(1); clf; hold on;
     drawPolygon3d(curve1, 'b'); drawPoint3d(curve1, 'bo');
     drawPolygon3d(curve2, 'g'); drawPoint3d(curve2, 'go');
     view(3); axis equal;
     tri = triangulatePolygonPair3d(curve1, curve2);
     vertices = [curve1 ; curve2];
     % display the resulting mesh
     figure(2); clf; hold on;
     drawMesh(vertices, tri);
     drawPolygon3d(curve1, 'color', 'b', 'linewidth', 2);
     drawPolygon3d(curve2, 'color', 'g', 'linewidth', 2);
     view(3); axis equal;

   References
   Based on the paper:
   "Optimal surface reconstruction from planar contours", 
   Fuchs, H., Kedem, Z. M., Uselton, S.P., 1977, Graphics and Image
   Processing, 20(10), 693-702.

   See also 
     triangulatePolygonPair, triangleArea3d, meshSurfaceArea




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 79
TRIANGULATEPOLYGONPAIR3D Compute a triangulation between a pair of 3D polygons.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
trimMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 507
TRIMMESH Reduce memory footprint of a polygonal mesh.

   [V2, F2] = trimMesh(V, F)
   Unreferenced vertices are removed.
   Following functions are implemented only for numeric faces:
       Duplicate vertices are removed.
       Duplicate faces are removed.

   Example
     [V, F] = createIcosahedron;
     F(13:20, :) = [];
     [V2, F2] = trimMesh(V, F);
     figure; drawMesh(V2, F2)
     view(3); axis equal;
     axis([-1 1 -1 1 0 2])

   See also 
     meshes3d, clipMeshVertices



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
TRIMMESH Reduce memory footprint of a polygonal mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
trimeshEdgeFaces


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1326
TRIMESHEDGEFACES Compute index of faces adjacent to each edge of a triangular mesh.

   EF = trimeshEdgeFaces(FACES)
   EF = trimeshEdgeFaces(VERTICES, FACES)
   EF = trimeshEdgeFaces(VERTICES, EDGES, FACES)
   Compute index array of faces adjacent to each edge of a mesh.
   FACES is a NF-by-3 array containing vertex indices of each face. The
   result EF is a NE-by-2 array containing the indices of the two faces
   incident to each edge. If an edge belongs to only one face, the other
   face index is ZERO.

   The list of edges (as array of source and target vertex indices) can be
   obtained from the function 'meshEdges'.

   Note: faces are listed in increasing order for each edge, and no
   information is kept about relative orientation of edge and face.

   Example
     % compute incidence list of each edge of an octahedron. For example,
     % first edge is incident to faces 1 and 5. Second edge is incident to
     % faces 4 and 8, and so on.
     [v, f] = createOctahedron;
     ef = trimeshEdgeFaces(v, f)
     ef =
          1     5
          4     8
          4     1
          5     8
          2     6
          1     2
          6     5
          3     7
          2     3
          7     6
          3     4
          7     8

   See also 
   meshes3d, meshEdgeFaces, trimeshMeanBreadth, meshEdges



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
TRIMESHEDGEFACES Compute index of faces adjacent to each edge of a triangular...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
trimeshMeanBreadth


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 693
TRIMESHMEANBREADTH Mean breadth of a triangular mesh.

   MB = trimeshMeanBreadth(VERTICES, FACES)
   Computes the mean breadth (proporitonal to the integral of mean
   curvature) of a triangular mesh.

   Example
     [V, F] = createCube;
     F2 = triangulateFaces(F);
     MB = trimeshMeanBreadth(V, F2)
     MB = 
         1.5000

   See also 
   meshes3d, trimeshSurfaceArea, trimeshEdgeFaces, polyhedronMeanBreadth

   References
   Stoyan D., Kendall W.S., Mecke J. (1995) "Stochastic Geometry and its
       Applications", John Wiley and Sons, p. 26
   Ohser, J., Muescklich, F. (2000) "Statistical Analysis of
       Microstructures in Materials Sciences", John Wiley and Sons, p.352



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
TRIMESHMEANBREADTH Mean breadth of a triangular mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
trimeshSurfaceArea


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 796
TRIMESHSURFACEAREA Surface area of a triangular mesh.

   S = trimeshSurfaceArea(V, F)
   S = trimeshSurfaceArea(V, E, F)
   Computes the surface area of the mesh specified by vertex array V and
   face array F. Vertex array is a NV-by-3 array of coordinates. 
   Face array is a NF-by-3, containing vertex indices of each face.

   Example
     % Compute area of an octahedron (equal to 2*sqrt(3)*a*a, with 
     % a = sqrt(2) in this case)
     [v f] = createOctahedron;
     trimeshSurfaceArea(v, f)
     ans = 
         6.9282

     % triangulate a compute area of a unit cube
     [v f] = createCube;
     f2 = triangulateFaces(f);
     trimeshSurfaceArea(v, f2)
     ans =
         6

   See also 
   meshes3d, meshSurfaceArea, trimeshMeanBreadth, triangulateFaces



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
TRIMESHSURFACEAREA Surface area of a triangular mesh.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
writeMesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 228
WRITEMESH Write 3D mesh data by inferring format from file name.

   writeMesh(FNAME, V, F)

   writeMesh(FNAME, MESH)

   Example
   writeMesh

   See also 
     meshes3d, readMesh, writeMesh_off, writeMesh_ply, writeMesh_stl




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
WRITEMESH Write 3D mesh data by inferring format from file name.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
writeMesh_off


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 188
WRITEMESH_OFF Write a mesh into a text file in OFF format.

   writeMesh_off(FNAME, V, F)

   Example
   writeMesh_off

   See also 
      meshes3d, writeMesh, readMesh_off, writeMesh_ply



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
WRITEMESH_OFF Write a mesh into a text file in OFF format.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
writeMesh_ply


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 520
WRITEMESH_PLY Write a mesh into a file in PLY format.

   writeMesh_ply(FNAME, VERTICES, FACES)

   writeMesh_ply(FNAME, MESH)

   writeMesh_ply(..., FORMAT) also specifies a file format for the written
   file. FORMAT can be either 'binary' (default) or 'ascii'.

   Example
   mesh = createSoccerBall;
   fileName = 'SoccerBall.ply';
   writeMesh_ply(fileName, mesh, 'Bin');
   mesh2 = readMesh(fileName);
   drawMesh(mesh2); axis equal

   See also 
   meshes3d, writeMesh, readMesh_ply, writeMesh_off, writeMesh_stl



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
WRITEMESH_PLY Write a mesh into a file in PLY format.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
writeMesh_stl


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 467
WRITEMESH_STL Write mesh data in the STL format.

   writeMesh_stl(FNAME, VERTICES, FACES)

   writeMesh_stl(FNAME, MESH)

   writeMesh_stl(FNAME, VERTICES, FACES, ...) see stlwrite for additonal
   options

   Example
   mesh = cylinderMesh([60 50 40 10 20 30 5], 1);
   writeMesh_stl('Cylinder.stl', mesh, 'bin');

   References
   Wrapper function for MATLAB's build-in stlwrite.

   See also 
     meshes3d, writeMesh, writeMesh_off, writeMesh_ply, readMaesh_stl



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
WRITEMESH_STL Write mesh data in the STL format.





