Utilities#
- class pyvcad.MaterialDefs#
Class representing material definitions that translates between material names, colors, and ids.
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: pyvcad.pyvcad.MaterialDefs) -> None
Default constructor mapping void material to id 0.
__init__(self: pyvcad.pyvcad.MaterialDefs, arg0: str) -> None
Constructor that takes a string as the path to the material configuration file.
- color(*args, **kwargs)#
Overloaded function.
color(self: pyvcad.pyvcad.MaterialDefs, arg0: typing.SupportsInt | typing.SupportsIndex) -> pyvcad.pyvcad.Vec4
Returns the color of the material given the id, as RGBA in the range [0, 255].
color(self: pyvcad.pyvcad.MaterialDefs, arg0: str) -> pyvcad.pyvcad.Vec4
Returns the color of the material given the name, as RGBA in the range [0, 255].
- contains(self: pyvcad.pyvcad.MaterialDefs, arg0: str) bool#
Returns true if the material exists given the name.
- density(*args, **kwargs)#
Overloaded function.
density(self: pyvcad.pyvcad.MaterialDefs, material: typing.SupportsInt | typing.SupportsIndex) -> float | None
Returns a material’s density in g/cm^3, or None when the configuration gives none.
A material entry in the JSON configuration may carry an optional “density” key in g/cm^3, the unit data sheets use. The void material (id 0) always has density 0. pv.mass_properties() uses these densities to turn volume fractions into mass.
- Parameters:
material (int) – Material id.
Example
>>> materials = pv.MaterialDefs(pv.j750_materials_path) >>> materials.density(materials.id("VeroCyan"))
density(self: pyvcad.pyvcad.MaterialDefs, name: str) -> float | None
Returns a material’s density in g/cm^3, or None when the configuration gives none.
- Parameters:
name (str) – Material name.
Example
>>> pv.MaterialDefs(pv.default_materials_path).density("red")
- id(*args, **kwargs)#
Overloaded function.
id(self: pyvcad.pyvcad.MaterialDefs, arg0: str) -> int
Returns the id of the material given the name.
id(self: pyvcad.pyvcad.MaterialDefs, arg0: pyvcad.pyvcad.Vec4) -> int
Returns the id of the material given the color.
- name(self: pyvcad.pyvcad.MaterialDefs, arg0: SupportsInt | SupportsIndex) str#
Returns the name of the material given the id.
- num_materials(self: pyvcad.pyvcad.MaterialDefs) int#
Returns the number of materials.
- palette(self: pyvcad.pyvcad.MaterialDefs) list[pyvcad.pyvcad.Vec4]#
Returns the material colors in the range [0, 255], indexed by material id. The list contains 4-component colors (RGBA).
- prescaled_color_list(self: pyvcad.pyvcad.MaterialDefs) list[pyvcad.pyvcad.Vec4]#
Returns the material colors divided by 255, i.e. in the floating point range [0, 1], indexed by material id. The list contains 4-component colors (RGBA).
- set_density(*args, **kwargs)#
Overloaded function.
set_density(self: pyvcad.pyvcad.MaterialDefs, material: typing.SupportsInt | typing.SupportsIndex, density: typing.SupportsFloat | typing.SupportsIndex) -> None
Sets or replaces a material’s density, in g/cm^3.
Use it when a configuration has no density for a material, or to try another value. The void material (id 0) is always empty and cannot be given a density.
- Parameters:
material (int) – Material id.
density (float) – Finite, non-negative density in g/cm^3.
Example
>>> materials.set_density(materials.id("clear"), 1.18)
set_density(self: pyvcad.pyvcad.MaterialDefs, name: str, density: typing.SupportsFloat | typing.SupportsIndex) -> None
Sets or replaces a material’s density, in g/cm^3.
- Parameters:
name (str) – Material name.
density (float) – Finite, non-negative density in g/cm^3.
Example
>>> materials.set_density("red", 1.17)
- update_color(self: pyvcad.pyvcad.MaterialDefs, arg0: SupportsInt | SupportsIndex, arg1: pyvcad.pyvcad.Vec4) None#
Updates the color of the material given the id. The new color is a 4-component color (RGBA) in the range [0, 255], e.g. pv.Vec4(77, 133, 204, 255).
- class pyvcad.ColorMap#
A piecewise-linear color map over [0, 1].
Colors are RGB Vec3s with channels in [0, 1], placed at stop values. get_color() clamps its input to [0, 1] and interpolates linearly between the two nearest stops.
Example
>>> import pyvcad as pv >>> cmap = pv.ColorMap() >>> cmap.add_color(0.0, pv.Vec3(0, 0, 1)) >>> cmap.add_color(1.0, pv.Vec3(1, 0, 0)) >>> purple = cmap.get_color(0.5)
- __init__(self: pyvcad.pyvcad.ColorMap) None#
Create an empty color map. get_color() returns white until a stop is added.
- add_color(self: pyvcad.pyvcad.ColorMap, value: SupportsFloat | SupportsIndex, color: pyvcad.pyvcad.Vec3) None#
Add a color stop, replacing any stop already at value.
- Parameters:
value (float) – Stop position. get_color() only reads values in [0, 1].
color (Vec3) – RGB color with channels in [0, 1].
- static create_grayscale() pyvcad.pyvcad.ColorMap#
Return a map from black at 0 to white at 1.
- static create_inferno() pyvcad.pyvcad.ColorMap#
Return a five-stop approximation of matplotlib’s inferno.
- static create_plasma() pyvcad.pyvcad.ColorMap#
Return a five-stop approximation of matplotlib’s plasma.
- static create_viridis() pyvcad.pyvcad.ColorMap#
Return a five-stop approximation of matplotlib’s viridis.
- get_color(self: pyvcad.pyvcad.ColorMap, value: SupportsFloat | SupportsIndex) pyvcad.pyvcad.Vec3#
Look up the color at a value.
The value is clamped to [0, 1]. Outside the first and last stops the end color is returned; between stops the color is interpolated linearly.
- Parameters:
value (float) – Value to look up.
- Returns:
RGB color with channels in [0, 1], or white when the map has no stops.
- Return type:
- class pyvcad.TreeSampler#
Utility for sampling a Node into voxel-based representations.
Changing root, voxel_size, or material_defs requires constructing a new TreeSampler. Call sample_dimensions() to query the grid shape.
- __init__(self: pyvcad.pyvcad.TreeSampler, root: pyvcad.pyvcad.Node, voxel_size: pyvcad.pyvcad.Vec3, material_defs: pyvcad.pyvcad.MaterialDefs = None) None#
Create a TreeSampler for a given root node and voxel size.
The constructor calls root.prepare(voxel_size, 6 * max(voxel_size)) itself, so the tree does not need to be prepared first. The grid covers the root’s bounding box grown by two voxels on every side.
- Parameters:
root (Node) – Root node of the tree to sample.
voxel_size (Vec3) – Size of a voxel in world units.
material_defs (MaterialDefs, optional) – Material definitions. Required by as_material_fraction_array() and sample_points_to_material_fraction_array(), and by the color methods when the attribute holds volume fractions.
- as_float_array(self: pyvcad.pyvcad.TreeSampler, attribute: str, progress: object = None) numpy.typing.NDArray[numpy.float32]#
Sample an attribute into a Float voxel grid.
- Parameters:
attribute (str) – Attribute name to sample.
progress (callable, optional) – Progress callback taking an int 0-100.
- Returns:
numpy_array of float32.
- as_material_fraction_array(self: pyvcad.pyvcad.TreeSampler, attribute: str, progress: object = None) numpy.typing.NDArray[numpy.float32]#
Sample a volume-fraction attribute into a per-material fraction grid.
- Parameters:
attribute (str) – Volume-fraction attribute name to sample.
progress (callable, optional) – Progress callback taking an int 0-100.
- Returns:
numpy_array of shape (num_voxels, num_materials), dtype float32.
- as_narrow_band_signed_distance_array(self: pyvcad.pyvcad.TreeSampler, progress: object = None, band_voxels: SupportsFloat | SupportsIndex = 3.0, coarse_factor: SupportsInt | SupportsIndex = 4) numpy.ndarray#
Sample the signed distance field on the as_signed_distance_array() grid, evaluating the design exactly only near its surface.
Voxels within band_voxels voxels of the surface hold exactly the values as_signed_distance_array() would; farther voxels keep the correct sign but not the exact distance. Contouring at 0 gives the same surface much faster when the design’s bounding box is mostly empty (shells, lattices on curved parts, separate bodies). Use as_signed_distance_array() when values far from the surface matter.
- Parameters:
progress (callable, optional) – Progress callback taking an int 0-100.
band_voxels (float) – Half-width of the exact band, in voxels. Defaults to 3.
coarse_factor (int) – Coarse probe cell size, in voxels (>= 2). Defaults to 4.
- Returns:
float32 array of shape (nx*ny*nz,), same layout as as_signed_distance_array().
- Return type:
numpy.ndarray
- as_rgba_array(self: pyvcad.pyvcad.TreeSampler, attribute: str, color_map: pyvcad.pyvcad.ColorMap, blend: bool = True, progress: object = None) numpy.ndarray#
Sample an attribute into an RGBA voxel grid.
Voxels outside the object are (0, 0, 0, 0). Scalar attributes are normalized to the sampled range (or the override range) and mapped through color_map. The flat index is (x + y*nx + z*nx*ny) * 4; get (nx, ny, nz) from sample_dimensions().
- Parameters:
attribute (str) – Attribute name to sample.
color_map (ColorMap) – Color map used to convert scalar attributes to RGBA.
blend (bool) – Blend volume fractions by weight; False picks one material per voxel at random by weight.
progress (callable, optional) – Progress callback taking an int 0-100.
- Returns:
uint8 array of shape (nx*ny*nz*4,).
- Return type:
numpy.ndarray
- as_signed_distance_array(self: pyvcad.pyvcad.TreeSampler, progress: object = None) numpy.ndarray#
Sample the tree into a signed distance field.
Every voxel is evaluated. Voxels where the tree has no value hold the largest float32. The flat index is x + y*nx + z*nx*ny; get (nx, ny, nz) from sample_dimensions().
- Parameters:
progress (callable, optional) – Progress callback taking an int 0-100.
- Returns:
float32 array of shape (nx*ny*nz,).
- Return type:
numpy.ndarray
- as_vec3_array(self: pyvcad.pyvcad.TreeSampler, attribute: str, progress: object = None) numpy.typing.NDArray[numpy.float32]#
Sample an attribute into a Vec3 voxel grid.
- Parameters:
attribute (str) – Attribute name to sample.
progress (callable, optional) – Progress callback taking an int 0-100.
- Returns:
numpy_array of float32.
- as_vec4_array(self: pyvcad.pyvcad.TreeSampler, attribute: str, progress: object = None) numpy.typing.NDArray[numpy.float32]#
Sample an attribute into a Vec4 voxel grid.
- Parameters:
attribute (str) – Attribute name to sample.
progress (callable, optional) – Progress callback taking an int 0-100.
- Returns:
numpy_array of float32.
- clear_double_attribute_range_override(self: pyvcad.pyvcad.TreeSampler) None#
Clear any explicit scalar normalization override and return to sampled min/max.
- culling_stats(self: pyvcad.pyvcad.TreeSampler) CullingStats#
Counts from the last sampling pass that could skip voxels.
Set by the voxel-grid pass behind as_rgba_array(), as_float_array(), as_vec3_array(), as_vec4_array() and as_material_fraction_array(), and by save_openvdb_occupancy_grid(): these skip voxels the tree’s distance bound proves hold no material. Also set by as_narrow_band_signed_distance_array(), which skips voxels proven to lie beyond its band (sampled_voxels then counts voxels evaluated exactly). Outputs are the same as sampling every voxel. Results served from a cache leave the counts unchanged; before any such pass they are empty. Culling falls back to every voxel for an approximate tree, a tree without a finite Lipschitz bound, or with OPENVCAD_DISABLE_CULLING=1 (see fallback_reason).
- Returns:
The counts of that pass.
- Return type:
- evaluate_points(self: pyvcad.pyvcad.TreeSampler, points: object, progress: object = None) object#
Evaluate the signed-distance field at arbitrary world-space points.
The points are evaluated in parallel, and results preserve the input order.
- Parameters:
points (list[Vec3] | numpy.ndarray) – Points to evaluate, as Vec3s or an (N, 3) float array.
progress (callable, optional) – Progress callback taking an int 0-100.
- Returns:
One signed distance or None per input point; a float64 numpy array with NaN in place of None when points is an array.
- Return type:
list[float | None]
- get_double_attribute_min_max(self: pyvcad.pyvcad.TreeSampler) tuple[float, float]#
Get the min and max values of the last sampled double attribute.
- Returns:
(min, max) as floats.
- Return type:
pair
- sample_dimensions(self: pyvcad.pyvcad.TreeSampler) tuple[int, int, int]#
Return the sample grid dimensions as (nx, ny, nz).
- sample_line(self: pyvcad.pyvcad.TreeSampler, start: pyvcad.pyvcad.Vec3, end: pyvcad.pyvcad.Vec3, count: SupportsInt | SupportsIndex, progress: object = None) list[tuple[float | None, AttributeSamples | None]]#
Sample the tree at evenly spaced points along a straight line.
- Parameters:
- Returns:
One (signed_distance_or_None, AttributeSamples_or_None) per sample.
- Return type:
list[tuple]
- sample_points(self: pyvcad.pyvcad.TreeSampler, points: collections.abc.Sequence[pyvcad.pyvcad.Vec3], progress: object = None) list[tuple[float | None, AttributeSamples | None]]#
Sample signed distance and attributes at arbitrary world-space points.
The points are sampled in parallel, and results preserve the input order.
- Parameters:
points (list[Vec3]) – Points to sample.
progress (callable, optional) – Progress callback taking an int 0-100.
- Returns:
One (signed_distance_or_None, AttributeSamples_or_None) per point.
- Return type:
list[tuple]
- sample_points_to_colors(self: pyvcad.pyvcad.TreeSampler, points: object, attribute: str, color_map: pyvcad.pyvcad.ColorMap, blend: bool = True, progress: object = None) object#
Sample colors at arbitrary points in space.
- Parameters:
points (list[Vec3] | numpy.ndarray) – Points to sample, as Vec3s or an (N, 3) float array.
attribute (str) – Attribute name to sample.
color_map (ColorMap) – Color map for attributes.
blend (bool) – Whether to blend multi-material samples.
progress (callable, optional) – Progress callback taking an int 0-100.
- Returns:
RGB colors (0-255) for each point; a float32 numpy array of shape (N, 3) when points is an array.
- Return type:
list[Vec3]
- sample_points_to_float_array(self: pyvcad.pyvcad.TreeSampler, points: object, attribute: str, progress: object = None) object#
Sample float attributes at arbitrary points in space.
- Parameters:
points (list[Vec3] | numpy.ndarray) – Points to sample, as Vec3s or an (N, 3) float array.
attribute (str) – Attribute name to sample.
progress (callable, optional) – Progress callback taking an int 0-100.
- Returns:
sampled values for each point; a float32 numpy array of shape (N,) when points is an array.
- Return type:
list[float]
- sample_points_to_material_fraction_array(self: pyvcad.pyvcad.TreeSampler, points: object, attribute: str, progress: object = None) numpy.typing.NDArray[numpy.float32]#
Sample a volume-fraction attribute at arbitrary points into a per-material fraction array.
- Parameters:
points (list[Vec3] | numpy.ndarray) – Points to sample, as Vec3s or an (N, 3) float array.
attribute (str) – Volume-fraction attribute name to sample.
progress (callable, optional) – Progress callback taking an int 0-100.
- Returns:
(num_points, num_materials) float32 array of per-material fractions.
- Return type:
numpy.ndarray
- sample_points_to_vec3_array(self: pyvcad.pyvcad.TreeSampler, points: object, attribute: str, progress: object = None) object#
Sample vec3 attributes at arbitrary points in space.
- Parameters:
points (list[Vec3] | numpy.ndarray) – Points to sample, as Vec3s or an (N, 3) float array.
attribute (str) – Attribute name to sample.
progress (callable, optional) – Progress callback taking an int 0-100.
- Returns:
sampled values for each point; a float32 numpy array of shape (N, 3) when points is an array.
- Return type:
list[Vec3]
- sample_points_to_vec4_array(self: pyvcad.pyvcad.TreeSampler, points: object, attribute: str, progress: object = None) object#
Sample vec4 attributes at arbitrary points in space.
- Parameters:
points (list[Vec3] | numpy.ndarray) – Points to sample, as Vec3s or an (N, 3) float array.
attribute (str) – Attribute name to sample.
progress (callable, optional) – Progress callback taking an int 0-100.
- Returns:
sampled values for each point; a float32 numpy array of shape (N, 4) when points is an array.
- Return type:
list[Vec4]
- save_openvdb_occupancy_grid(self: pyvcad.pyvcad.TreeSampler, file_path: str, progress: object = None) None#
Sample the tree into a boolean occupancy grid and save it to a VDB file.
The output file contains a single OpenVDB BoolGrid named ‘occupancy’. Voxels are occupied where the sampled signed distance is <= 0.
- Parameters:
file_path (str) – VDB file path to write.
progress (callable, optional) – Progress callback taking an int 0-100.
- set_double_attribute_range_override(self: pyvcad.pyvcad.TreeSampler, min_value: SupportsFloat | SupportsIndex, max_value: SupportsFloat | SupportsIndex) None#
Override scalar normalization min/max for double-valued attribute coloring.
- Parameters:
min_value (float) – Minimum scalar value.
max_value (float) – Maximum scalar value.
- set_undefined_attribute_pattern_enabled(self: pyvcad.pyvcad.TreeSampler, enabled: bool) None#
Enable or disable the undefined-attribute stripe pattern.
When enabled (default True), inside voxels/points missing the selected attribute are rendered with a subtle world-space stripe pattern instead of plain gray.
- Parameters:
enabled (bool) – True to show the pattern, False for plain gray.
- class pyvcad.CullingStats#
Counts from a sampling pass that skipped voxels proven empty.
A voxel is skipped only when the tree’s distance bound proves it holds no material, so the output is identical to sampling every voxel. Culling falls back to sampling everything when the tree’s distance_accuracy() is approximate, its lipschitz_bound() is not finite, or it is switched off (set_culling_enabled(False) on a compiler, or the environment variable OPENVCAD_DISABLE_CULLING=1).
- property accuracy#
The root’s distance_accuracy().
- property active#
True if culling ran; False if every voxel was sampled.
- property bandwidth#
The bandwidth the root was prepared with.
- property fallback_reason#
Why culling did not run (empty when active).
- property lipschitz#
The root’s lipschitz_bound().
- property probes#
evaluate() calls spent on the proofs.
- property sampled_voxels#
Voxels sampled (one sample() call each).
- skipped_fraction(self: pyvcad.pyvcad.CullingStats) float#
Fraction of voxels skipped.
- property skipped_voxels#
Voxels proven empty without a sample() call.
- property total_voxels#
Voxels in the layers built so far (the whole grid once a pass has finished).
- class pyvcad.MeshSampler#
Fast signed-distance sampler for SurfaceMesh.
Builds a CGAL search tree once and reuses it for every query. The mesh should be closed, since the sign comes from an inside/outside test.
- __init__(self: pyvcad.pyvcad.MeshSampler, mesh: pyvcad.pyvcad.SurfaceMesh) None#
Constructor. Builds a reusable sampler for the provided surface mesh.
- Parameters:
mesh (SurfaceMesh) – The mesh to sample.
- signed_distance(self: pyvcad.pyvcad.MeshSampler, x: SupportsFloat | SupportsIndex, y: SupportsFloat | SupportsIndex, z: SupportsFloat | SupportsIndex) float#
Returns the signed distance from the query point to the mesh.
- Parameters:
x (float) – Query point X.
y (float) – Query point Y.
z (float) – Query point Z.
- Returns:
Distance to the nearest triangle, negative inside the mesh and positive outside.
- Return type:
float
Surface probing#
Interrogate a prepared tree for where its surface is and which way it faces, and
turn a normal into the angles a Rotate node wants. See the
examples/surface_probe scripts for the full workflow.
- class pyvcad.SurfaceProbeResult#
The result of probing a prepared tree for its surface. Carries the surface position, the outward unit normal at that position, and the residual signed distance left after the probe converged.
- property hit#
True when the probe converged onto the surface. The position and normal are only meaningful when this is True.
- Type:
bool
- property normal#
The outward unit surface normal at the position, pointing away from the solid.
- Type:
- property signed_distance#
The residual signed distance at the position. Near zero for a converged probe.
- Type:
float
- pyvcad.probe_point(node: pyvcad.pyvcad.Node, point: pyvcad.pyvcad.Vec3, tolerance: SupportsFloat | SupportsIndex = 0.0001, max_iterations: SupportsInt | SupportsIndex = 16) pyvcad.pyvcad.SurfaceProbeResult#
Projects a point onto the nearest surface of a prepared tree and reports the normal there.
The starting point may be inside, outside, or already on the surface; it is walked down the signed distance field until it lands on the surface. This is the query behind the renderer’s Probe tool: pick a point on screen, then ask what the surface is doing there.
- Parameters:
node (Node) – The prepared node to interrogate. Call prepare() first.
point (Vec3) – The starting point in world coordinates.
tolerance (float, optional) – The signed distance that counts as on the surface. Defaults to 1e-4.
max_iterations (int, optional) – The maximum number of steps to take. Defaults to 16.
- Returns:
The surface position, unit normal, and residual signed distance.
- Return type:
Example
>>> import pyvcad as pv >>> sphere = pv.Sphere(pv.Vec3(0, 0, 0), 10.0) >>> sphere.prepare(pv.Vec3(0.2, 0.2, 0.2), 1.0) >>> probe = pv.probe_point(sphere, pv.Vec3(8.0, 0.0, 0.0)) >>> print(probe.position.x, probe.normal.x) 10.0 1.0
- pyvcad.probe_ray(node: pyvcad.pyvcad.Node, origin: pyvcad.pyvcad.Vec3, direction: pyvcad.pyvcad.Vec3, step_size: SupportsFloat | SupportsIndex = 0.0, tolerance: SupportsFloat | SupportsIndex = 0.0001) pyvcad.pyvcad.SurfaceProbeResult#
Casts a ray at a prepared tree and reports the first surface it enters.
The ray is clipped to the node’s bounding box, marched until it crosses into the solid, and then refined onto the surface. This is the query a viewport pick maps onto, with the camera position as the origin and the unprojected click as the direction.
- Parameters:
node (Node) – The prepared node to interrogate. Call prepare() first.
origin (Vec3) – The ray origin in world coordinates.
direction (Vec3) – The ray direction. Need not be normalized, but must not be zero length.
step_size (float, optional) – The march step in mm. Pass 0 to derive one from the bounding box.
tolerance (float, optional) – The signed distance that counts as on the surface. Defaults to 1e-4.
- Returns:
The entry point, unit normal, and residual signed distance. hit is False when the ray misses the node.
- Return type:
Example
>>> import pyvcad as pv >>> sphere = pv.Sphere(pv.Vec3(0, 0, 0), 10.0) >>> sphere.prepare(pv.Vec3(0.2, 0.2, 0.2), 1.0) >>> probe = pv.probe_ray(sphere, pv.Vec3(50.0, 0.0, 0.0), pv.Vec3(-1.0, 0.0, 0.0)) >>> print(probe.hit, probe.position.x) True 10.0
- pyvcad.surface_normal(node: pyvcad.pyvcad.Node, point: pyvcad.pyvcad.Vec3) pyvcad.pyvcad.Vec3#
Returns the outward unit surface normal of a prepared tree at a point.
This is the normalized signed distance gradient. Away from the surface it is the direction of steepest increase of the field. Returns a zero vector when the gradient is degenerate.
- Parameters:
- Returns:
The outward unit normal.
- Return type:
Example
>>> import pyvcad as pv >>> sphere = pv.Sphere(pv.Vec3(0, 0, 0), 10.0) >>> sphere.prepare(pv.Vec3(0.2, 0.2, 0.2), 1.0) >>> normal = pv.surface_normal(sphere, pv.Vec3(0.0, 10.0, 0.0)) >>> print(normal.y) 1.0
- pyvcad.alignment_angles(forward: pyvcad.pyvcad.Vec3, up: pyvcad.pyvcad.Vec3 = <pyvcad.pyvcad.Vec3 object at 0x1046ff7b0>) pyvcad.pyvcad.Vec3#
Computes the Rotate angles that aim a child node’s local axes along a chosen frame.
The child’s local +Z is aimed along forward and its local +Y along up. up only has to be roughly right: it is orthogonalized against forward, and a world axis is substituted when the two are parallel.
The Text node extrudes along +Z, so passing a surface normal as forward stands text up off that surface. Text builds its glyphs on a flipped X axis, which puts their visual up along its own -Y, so pass the negated world up to get text that reads upright.
- Parameters:
- Returns:
Euler angles in degrees, packed as (pitch, yaw, roll) for the Rotate node.
- Return type:
Example
>>> import pyvcad as pv >>> probe = pv.probe_point(sphere, pv.Vec3(8.0, 0.0, 0.0)) >>> angles = pv.alignment_angles(probe.normal, pv.Vec3(0, 0, -1)) >>> facing_text = pv.Rotate(angles, text)