simvx.core.gizmo

Transform gizmos for 3D scene editing (translate, rotate, scale).

Handles the interaction math for picking and dragging gizmo handles. Actual rendering of gizmo visuals is the graphics backend’s responsibility.

Module Contents

Classes

GizmoMode

Active manipulation mode for the gizmo.

GizmoAxis

Which axis or axis-pair the user is interacting with.

Gizmo

Interactive transform gizmo operating in world space.

Functions

circle_lines_2d

Return line segments approximating a circle in 2D.

circle_lines_3d

Return line segments approximating a circle in 3D on the plane defined by u, v axes.

Data

API

simvx.core.gizmo.log

‘getLogger(…)’

simvx.core.gizmo.__all__

[‘GizmoMode’, ‘GizmoAxis’, ‘Gizmo’, ‘circle_lines_2d’, ‘circle_lines_3d’]

simvx.core.gizmo.circle_lines_2d(cx: float, cy: float, radius: float, segments: int = _CIRCLE_SEGMENTS) list[tuple[simvx.core.math.types.Vec2, simvx.core.math.types.Vec2]][source]

Return line segments approximating a circle in 2D.

simvx.core.gizmo.circle_lines_3d(center: simvx.core.math.types.Vec3, u: simvx.core.math.types.Vec3, v: simvx.core.math.types.Vec3, radius: float, segments: int = _CIRCLE_SEGMENTS) list[tuple[simvx.core.math.types.Vec3, simvx.core.math.types.Vec3]][source]

Return line segments approximating a circle in 3D on the plane defined by u, v axes.

class simvx.core.gizmo.GizmoMode[source]

Bases: enum.Enum

Active manipulation mode for the gizmo.

TRANSLATE

‘auto(…)’

ROTATE

‘auto(…)’

SCALE

‘auto(…)’

__new__(value)
__repr__()
__str__()
__dir__()
__format__(format_spec)
__hash__()
__reduce_ex__(proto)
__deepcopy__(memo)
__copy__()
name()
value()
class simvx.core.gizmo.GizmoAxis[source]

Bases: enum.Enum

Which axis or axis-pair the user is interacting with.

X

‘auto(…)’

Y

‘auto(…)’

Z

‘auto(…)’

XY

‘auto(…)’

XZ

‘auto(…)’

YZ

‘auto(…)’

ALL

‘auto(…)’

__new__(value)
__repr__()
__str__()
__dir__()
__format__(format_spec)
__hash__()
__reduce_ex__(proto)
__deepcopy__(memo)
__copy__()
name()
value()
class simvx.core.gizmo.Gizmo[source]

Interactive transform gizmo operating in world space.

Supports three manipulation modes (translate, rotate, scale) and provides ray-based picking / dragging logic. The graphics backend is responsible for drawing the visual handles; this class only does the math.

Initialization

property mode: simvx.core.gizmo.GizmoMode[source]
pick_axis(ray_origin: simvx.core.math.types.Vec3, ray_dir: simvx.core.math.types.Vec3) simvx.core.gizmo.GizmoAxis | None[source]

Ray-test the gizmo handles and return the closest hit axis.

For translate/scale modes the handles are axis shafts (thin cylinders) and small plane-pair quads. For rotate mode the handles are three circles (one per principal axis).

Returns None when nothing is hit.

begin_drag(axis: simvx.core.gizmo.GizmoAxis, ray_origin: simvx.core.math.types.Vec3, ray_dir: simvx.core.math.types.Vec3) None[source]

Start a drag interaction on axis.

update_drag(ray_origin: simvx.core.math.types.Vec3, ray_dir: simvx.core.math.types.Vec3) simvx.core.math.types.Vec3[source]

Compute the incremental delta since the last update.

Returns a Vec3 whose meaning depends on the current mode:

  • TRANSLATE – world-space translation delta.

  • ROTATE – (angle_x, angle_y, angle_z) in radians.

  • SCALE – per-axis scale factor delta (centred on 1.0 = no change, returned as additive offset so caller does current_scale += delta).

end_drag() None[source]

Finish dragging and reset internal drag state.

cycle_mode() None[source]

Cycle through TRANSLATE -> ROTATE -> SCALE -> TRANSLATE.