fabien van mook

all packages "fvm-*"

package "fvm-geometry-obj"

function file "wobj_read_simple.m"

Function obj = wobj_read_simple(fn)

reads vertex and face information from a simple (!) .obj
file. An .obj file is a three-dimensional geometry definition
file format first developed by Wavefront Technologies.

It is assumed that: 
-- each vertex is defined as
     "v <x> <y> <z>"
   on a line, where "<x>", "<y>" and "<z>" are text 
   representations of reals for the x,y,z coordinates.
-- each face is defined as
     "f <iv1> <iv2> <iv3>"
   on a line, where "<iv1>", "<iv2>" and "<iv3>" are the
   indices to the vertices (the first vertex has index 1),
   which make a triangle. Other types of polygons are not 
   allowed.
Other information in the file is ignored.

The function internally calls perl with the external scripts
"wobj_extract_vertices.pl" and "wobj_extract_faces.pl", which
must be somewhere in the current directory or the Octave load
path.

The output is a struct with two fields:
  obj.vertices contains a matrix with three columns;
  obj.faces    contains a matrix with three columns.


(c) 2026 fabien van mook

2026.08.20 release of this file within package "fvm-geometry-obj" under GNU GPLv3+