mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 00:09:41 +00:00
transform logging
This commit is contained in:
parent
c541e1b894
commit
9d25c28534
1 changed files with 48 additions and 4 deletions
|
@ -1355,9 +1355,9 @@ module frame_map(x,y,z,p,reverse=false)
|
||||||
|
|
||||||
// Function&Module: skew()
|
// Function&Module: skew()
|
||||||
//
|
//
|
||||||
// Synopsis: Skews children along various axes.
|
// Synopsis: Skews (or shears) children along various axes.
|
||||||
// SynTags: Trans, Path, VNF, Mat
|
// SynTags: Trans, Path, VNF, Mat
|
||||||
// Topics: Affine, Matrices, Transforms, Skewing
|
// Topics: Affine, Matrices, Transforms, Skewing, Shearing
|
||||||
// See Also: move(), rot(), scale()
|
// See Also: move(), rot(), scale()
|
||||||
//
|
//
|
||||||
// Usage: As Module
|
// Usage: As Module
|
||||||
|
@ -1368,7 +1368,7 @@ module frame_map(x,y,z,p,reverse=false)
|
||||||
// mat = skew([sxy=]|[axy=], [sxz=]|[axz=], [syx=]|[ayx=], [syz=]|[ayz=], [szx=]|[azx=], [szy=]|[azy=]);
|
// mat = skew([sxy=]|[axy=], [sxz=]|[axz=], [syx=]|[ayx=], [syz=]|[ayz=], [szx=]|[azx=], [szy=]|[azy=]);
|
||||||
//
|
//
|
||||||
// Description:
|
// Description:
|
||||||
// Skews geometry by the given skew factors.
|
// Skews geometry by the given skew factors. Skewing is also referred to as shearing.
|
||||||
// * Called as the built-in module, skews all children.
|
// * Called as the built-in module, skews all children.
|
||||||
// * Called as a function with a point in the `p` argument, returns the skewed point.
|
// * Called as a function with a point in the `p` argument, returns the skewed point.
|
||||||
// * Called as a function with a list of points in the `p` argument, returns the list of skewed points.
|
// * Called as a function with a list of points in the `p` argument, returns the list of skewed points.
|
||||||
|
@ -1572,4 +1572,48 @@ function _apply(transform,points) =
|
||||||
"), data of dimension ",datadim));
|
"), data of dimension ",datadim));
|
||||||
|
|
||||||
|
|
||||||
|
// Section: Saving and restoring
|
||||||
|
|
||||||
|
|
||||||
|
$transform = IDENT;
|
||||||
|
|
||||||
|
module translate(v)
|
||||||
|
{
|
||||||
|
$transform = $transform * (is_vector(v) && (len(v)==2 || len(v)==3) ? affine3d_translate(point3d(v)) : IDENT);
|
||||||
|
_translate(v) children();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module rotate(a,v)
|
||||||
|
{
|
||||||
|
rot3 = is_finite(a) && is_vector(v) && (len(v)==2 || len(v)==3) ? affine3d_rot_by_axis(v,a)
|
||||||
|
: is_finite(a) ? affine3d_zrot(a)
|
||||||
|
: same_shape(a,[0]) ? affine3d_xrot(a.x)
|
||||||
|
: same_shape(a,[0,0]) ? affine3d_yrot(a.y)*affine3d_xrot(a.x)
|
||||||
|
: same_shape(a,[0,0,0])? affine3d_zrot(a.z)*affine3d_yrot(a.y)*affine3d_xrot(a.x)
|
||||||
|
: IDENT;
|
||||||
|
$transform = $transform * rot3;
|
||||||
|
_rotate(a=a,v=v) children();
|
||||||
|
}
|
||||||
|
|
||||||
|
module scale(v)
|
||||||
|
{
|
||||||
|
s3 = is_finite(v) ? affine3d_scale([v,v,v])
|
||||||
|
: is_vector(v) ? affine3d_scale(v)
|
||||||
|
: IDENT;
|
||||||
|
$transform = $transform * s3;
|
||||||
|
_scale(v) children();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module multmatrix(m)
|
||||||
|
{
|
||||||
|
m3 = !is_matrix(m) ? IDENT
|
||||||
|
: len(m)>0 && len(m)<=4 && len(m[0])>0 && len(m[0])<=4 ? submatrix_set(IDENT, m)
|
||||||
|
: IDENT;
|
||||||
|
$transform = $transform * m3;
|
||||||
|
_multmatrix(m) children();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
|
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
|
||||||
|
|
Loading…
Reference in a new issue