mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-02 01:00:13 +02:00
Added missing affine mirror matrices.
This commit is contained in:
33
affine.scad
33
affine.scad
@@ -75,6 +75,22 @@ function affine2d_zrot(ang) = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// Function: affine2d_mirror()
|
||||||
|
// Usage:
|
||||||
|
// mat = affine2d_mirror(v);
|
||||||
|
// Description:
|
||||||
|
// Returns the 3x3 affine2d matrix to perform a reflection of a 2D vector across the line given by its normal vector.
|
||||||
|
// Arguments:
|
||||||
|
// v = The normal vector of the line to reflect across.
|
||||||
|
function affine2d_mirror(v) =
|
||||||
|
let(v=normalize(point2d(v)), a=v.x, b=v.y)
|
||||||
|
[
|
||||||
|
[1-2*a*a, 0-2*a*b, 0],
|
||||||
|
[0-2*a*b, 1-2*b*b, 0],
|
||||||
|
[ 0, 0, 1]
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
// Function: affine2d_skew()
|
// Function: affine2d_skew()
|
||||||
// Usage:
|
// Usage:
|
||||||
// affine2d_skew(xa, ya)
|
// affine2d_skew(xa, ya)
|
||||||
@@ -243,6 +259,23 @@ function affine3d_rot_from_to(from, to) = let(
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// Function: affine3d_mirror()
|
||||||
|
// Usage:
|
||||||
|
// mat = affine3d_mirror(v);
|
||||||
|
// Description:
|
||||||
|
// Returns the 4x4 affine3d matrix to perform a reflection of a 3D vector across the plane given by its normal vector.
|
||||||
|
// Arguments:
|
||||||
|
// v = The normal vector of the plane to reflect across.
|
||||||
|
function affine3d_mirror(v) =
|
||||||
|
let(v=normalize(point3d(v)), a=v.x, b=v.y, c=v.z)
|
||||||
|
[
|
||||||
|
[1-2*a*a, -2*a*b, -2*a*c, 0],
|
||||||
|
[ -2*b*a, 1-2*b*b, -2*b*c, 0],
|
||||||
|
[ -2*c*a, -2*c*b, 1-2*c*c, 0],
|
||||||
|
[ 0, 0, 0, 1]
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
// Function: affine3d_skew_xy()
|
// Function: affine3d_skew_xy()
|
||||||
// Usage:
|
// Usage:
|
||||||
// affine3d_skew_xy(xa, ya)
|
// affine3d_skew_xy(xa, ya)
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
BOSL_VERSION = [2,0,49];
|
BOSL_VERSION = [2,0,50];
|
||||||
|
|
||||||
|
|
||||||
// Section: BOSL Library Version Functions
|
// Section: BOSL Library Version Functions
|
||||||
|
Reference in New Issue
Block a user