Skip to content
Discussion options

You must be logged in to vote

I want to obtain the world transformation of shapes whose parents are Rectangle to get the coordinates of the four corner points of all rectangles

If it's for visualization purpose, I have the following workaround

# iterate over all shapes
obj = scene.shapes()[idx]
params = mi.traverse(obj)
if obj.__repr__().startswith('Rectangle'):
        v = np.array([[-1.0, -1, 0], [1, -1, 0], [1, 1, 0], [-1, 1, 0]])
        f = np.array([[0, 1, 2], [0, 2, 3]])
        v_ = params["to_world"] @ mi.Point3f(v)
        v = v_.numpy()

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Mephisto405
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants