Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Scad_ml.Vec3
Source3-dimensional vector type.
In addition to basic math and vector operations, relevant transformation functions (and aliases) are mirroring those found in Scad
are provided. This allows for points in space represented by this type to moved around in a similar fashion to Scad.t
.
include module type of struct include Vec3 end
horizontal_op f a b
Hadamard (element-wise) operation between vectors a
and b
using the function f
.
distance a b
Calculate the magnitude of the difference (Hadamard subtraction) between a
and b
.
normalize t
Normalize t
to a vector for which the magnitude is equal to 1. e.g. norm (normalize t) = 1.
Equivalent to those found in Scad
. Quaternion operations are provided when this module is included in Scad_ml
.
rotate r t
Euler (xyz) rotation of t
by the angles in theta
. Equivalent to rotate_x rx t |> rotate_y ry |> rotate_z rz
, where (rx, ry, rz) = r
.
rotate_about_pt r pivot t
Translates t
along the vector pivot
, euler rotating the resulting vector with r
, and finally, moving back along the vector pivot
. Functionally, rotating about the point in space arrived at by the initial translation along the vector pivot
.
mirror ax t
Mirrors t
on a plane through the origin, defined by the normal vector ax
.
quaternion q t
Rotate t
with the quaternion q
.
quaternion_about_pt q p t
Translates t
along the vector p
, rotating the resulting vector with the quaternion q
, and finally, moving back along the vector p
. Functionally, rotating about the point in space arrived at by the initial translation along the vector p
.