Skip to content

PShape from OBJ vertices #167

Description

@shiffman

Related to processing/processing#2873, we need to clean up the documentation related to iterating over the vertices of a PShape. When loading an obj, getVertexCount() will typically return 0 since all the vertices are in the child shapes. Two ways of iterating over all the vertices are:

  PShape obj = loadShape("test.obj");
  int children = obj.getChildCount();
  for (int i = 0; i < children; i++) {
    PShape child = obj.getChild(i);
    int total = child.getVertexCount();
    for (int j = 0; j < total; j++) {
      PVector v = child.getVertex(j);
      point(v.x, v.y, v.z);
    }
  }

and

  PShape tes = obj.getTessellation();
  int total = tes.getVertexCount();
  for (int j = 0; j < total; j++) {
    PVector v = tes.getVertex(j);
    point(v.x, v.y, v.z);
  }

Where should this go? loadShape()? getVertexCount()? getVertex()?

@codeanticode

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions