Obtaining the vertices and their coordinates from a "DiscreteGeometry" object.

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

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')

More Answers (0)

Products

Release

R2019a

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!