Obtaining the vertices and their coordinates from a "DiscreteGeometry" object.
5 views (last 30 days)
Show older comments
MathWorks Support Team
on 20 May 2019
Answered: MathWorks Support Team
on 20 May 2019
I have trouble figuring out what a vertex in a "DiscreteGeometry" object is.
Let's say I do the following
>> model = createpde(3);
>> dg = importGeometry(model,'ForearmLink.stl')
>> [FaceFacets, FaceFacetVertices] = dg.allDisplayFaces();
I get much more "FaceFacetVertices" than the "DiscreteGeometry" object has NumVertices.
Is there a way to get the actual nodes (or their coordinates) from the "DiscreteGeometry" (dg) object?
Accepted Answer
MathWorks Support Team
on 20 May 2019
The object has a function called "vertexCoordinates" that will provide a list of all the vertices with their coordinates.
Here is an example of how to accomplish this:
>> model = createpde(3);
>> dg = importGeometry(model,'ForearmLink.stl');
>> vertices = dg.vertexCoordinates(1:dg.NumVertices)
If you would like to obtain the coordinates for a single vertex you can do the following:
>> dg.vertexCoordinates(2) % this will give you the coordinates of Vertex 2.
If you would like to visualize where the vertices are located in the geometry you can do so by executing the following function:
>> pdegplot(dg,'VertexLabels','on')
0 Comments
More Answers (0)
See Also
Categories
Find more on Geometry and Mesh in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!