-
Notifications
You must be signed in to change notification settings - Fork 210
Open
Labels
Description
With actor_from_primitive(..., centers=[...]), the geometry is already translated to each center by repeat_primitive.
If the actor is also shifted by centers[0], everything gets translated twice (double offset).
As a result, the repeated actor does not align with the expected positions (markers / individual actors).
Here a screenshot of the issue
Reproduction code for the issue
import numpy as np
import fury.primitive as fp
from fury.actor.core import actor_from_primitive
from fury import actor, window
centers = np.array([[3, 0, 0], [6, 0, 0], [9, 0, 0]], dtype=np.float32)
colors = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
vertices, faces = fp.prim_sphere(phi=16, theta=16)
multi = actor_from_primitive(
vertices, faces, centers, colors=colors, scales=1.0, smooth=True
)
singles = []
for i in range(3):
s = actor_from_primitive(
vertices, faces, centers[i : i + 1],
colors=colors[i : i + 1], scales=1.0, smooth=True,
)
s.local.y -= 4
singles.append(s)
marker_centers = np.vstack([centers, centers - [0, 4, 0]])
markers = actor.sphere(
centers=marker_centers,
colors=(1, 1, 1),
radii=0.15,
)
label_top = actor.text(
"repeat_primitive (1 actor)",
position=[-2, 0, 0],
colors=(1, 1, 1),
anchor="middle-right",
)
label_bot = actor.text(
"individual actors",
position=[-2, -4, 0],
colors=(1, 1, 1),
anchor="middle-right",
)
scene = window.Scene()
scene.background = (0.1, 0.1, 0.15)
scene.add(multi)
for s in singles:
scene.add(s)
scene.add(markers)
scene.add(label_top)
scene.add(label_bot)
show_m = window.ShowManager(
scene=scene, size=(900, 500), title="repeat_primitive offset test"
)
show_m.start()Reactions are currently unavailable