Skip to content

Refactor geometry transforms 2

Co-authored-by: @sreekanth-arikatla - Subseed of !153 (closed)

Main changes

  • Geometry class does not have a position, orientation, scaling combination anymore, but a rigid transformation (translation + rotation) as well as a separate uniform scaling.
  • The value of that transformation can be changed using setTranslation(), setRotation(), and setScaling().
  • scale(), translate(), and rotate() are utility functions which behavior vary based on the parameter TransformType: ConcatenateToTransform, the default value, will concatenate transformations to the rigid transform and signals that the transform has been modified; ApplyToData directly enforces the transformation given to the internal data of the geometry, and signals that the data has been modified (useful to enforce offsets at the beginning of the simulation to avoid concatenating that offset continuously).
  • A new base class AnalyticalGeomerty is created for Capsule, Plane, Cube and Sphere. It wraps the common attributes to those geometries: a position and an orientation axis. The values of those properties after the transform is applied are also stored to avoid redundant computations.
  • Subclasses of AnalyticalGeometry often show properties related to size: width, radius, length, etc. Those have their post-transform sibling also.
  • The Plane has a Normal API which simply wraps the AnalyticalGeometry orientation axis.
  • The mesh base class also keeps track of a post-transform value for the vertex positions.
  • Those internal data properties can be set with regular setting methods, which also signals that the internal data has been modified.
  • Get methods for those properties have a behavior which vary based on the parameter DataType: PostTransform is the default value, and it will return the post transform data, computing it by applying the transform if it was not yet done.
  • CollisionDetection classes are updated to use that post-transform data
  • RenderDelegates are updated to update their internal data only when the geometry data has been modified (use VTK sources and transform filter), as well as the rigid transform when that one has been modified also.
  • Maps, Controllers, and tests are updated to use the correct API: set translation and rotation and not position/orientation.
  • Update Geometry and Plane test to take into account the change of API: getRotation is now returning a Mat3d instead of a quaternion for less operations, and getNormal will return a normalized vector even if the one set was not normalized. Use isApprox to allow for low variability.
  • Update API in sandbox example + new example

Other

  • Correct error with texture coordinates instantiation in AssimpIO
  • Replaced all the names where vertice is used instead of vertex to mean singular vertex.
  • Got rid of the vertexDisplacements variable in the Mesh class, difference between the vertexPosition and the initialVertexPositions: it was requiring additional bookeeping which was not necessary.

Merge request reports