Skip to content

Conversation

tymokvo
Copy link
Contributor

@tymokvo tymokvo commented Aug 21, 2025

Summary

  • Expose gp_Trsf::SetValues
  • Add transform module, tests
  • Add gp_trsf(&DMat4) -> gp_Trsf
  • Add Shape::transform

Description

I needed a way to define a Shape once and then duplicate that geometry throughout a model space using transform matrices, similar to "blocks" from the CAD world or "instanced rendering" from the GPU programming world.

This PR exposes OCC's implementation of this capability through the BRepBuilderAPI_Transform class. This requires using a gp_Trsf instance as the transform matrix. There didn't seem to be a convenient way to construct these from a glam type, so I added the transform module and a simple test to ensure the construction is correct.

One caveat here (that is also noted in the comments) is that the gp_Trsf constructor:

  • Only allows setting the upper 3x4 matrix
    • I.e. cannot set the w component of any column
  • Orthogonalizes the matrix

So, the values of the output can be different than the input based on the orthogonality of the input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant