1

OpenMesh has its VectorT class which I believe is used to carry out all sorts of position vector operations (additions/subtractions, inner and outer products, etc.). Are there any examples available on how to actually use it? I would be in particular interested in

  1. How to define and initialize a 3D vector of coordinates
  2. How to properly convert a vertex position (of Point type) to a VectorT type, or, alternatively, how to get a vertex position as a VectorT type right away. So far I'm using mesh.point(vhandle) which, however, returns a Point() type.

Edit: Apparently Point is some kind of VectorT itself because the VectorT member functions work on Point objects as well.

Botond
  • 2,640
  • 6
  • 28
  • 44

1 Answers1

2

Examples for math operation using OpenMesh native point type:

  1. OpenMesh::Vec3f myVec = OpenMesh::Vec3f(0, 0, 0);

  2. float distance = (point1 - point2).norm(); also available: l1_norm(), l8_norm(), sqrnorm()

  3. Point interpolated_point = (1 - a) * point1 + a * point2;

  4. Vec3f crossProduct = vec1 % vec2; only defined for Vec3 (and as you mentioned Point)

  5. Vec3f dotProduct = vec1 | vec2;

Mark Loyman
  • 1,983
  • 1
  • 14
  • 23