# [OpenSCAD] Can you suggest some libraries of standard geometry conversions?

Andrew Plumb andrew at plumb.org
Sat Sep 19 11:09:57 EDT 2015

```A couple of the basics are there - https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#Mathematical_Operators <https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#Mathematical_Operators>

- Dot-product is implicit when multiplying (the ‘*’ operation) two vectors of equal length.

- Use the cross(v1,v2) function for cross-product of two vectors.

I had included matrix inverse operation from the eigen library in my first attempt at including matrix operation support in OpenSCAD, but that got lost thru the major Value rewrite/re-architecting that happened a couple of years ago.

Andrew.

> On Sep 19, 2015, at 10:38 AM, ufomorace <ant.stewart at yahoo.com> wrote:
>
> I love it when a geometry library has options like rotate towards, Vector3 to
> euler angles, Distance, lerp, and similar options. Is there any chance you
> could add these functions or an openscad file because they are not easy to
> code them to openscad, it's would be awesome to find a heavy geom functions
> library and just copy it into openscad engine:
>
> Vector3 modules
> Angle	 Returns the angle in degrees between from and to.
> ClampMagnitude 	Returns a copy of vector with its magnitude clamped to
> maxLength.
> Cross	Cross Product of two vectors.
> Distance	Returns the distance between a and b.
> Dot	Dot Product of two vectors.
> Lerp	Linearly interpolates between two vectors.
> LerpUnclamped	Linearly interpolates between two vectors.
> Max	Returns a vector that is made from the largest components of two
> vectors.
> Min	Returns a vector that is made from the smallest components of two
> vectors.
> MoveTowards	Moves a point current in a straight line towards a target point.
> Normalize
> OrthoNormalize	Makes vectors normalized and orthogonal to each other.
> Project	Projects a vector onto another vector.
> ProjectOnPlane	Projects a vector onto a plane defined by a normal orthogonal
> to the plane.
> Reflect	Reflects a vector off the plane defined by a normal.
> RotateTowards	Rotates a vector current towards target.
> Scale	Multiplies two vectors component-wise.
> Slerp	Spherically interpolates between two vectors.
> SlerpUnclamped	Spherically interpolates between two vectors.
> SmoothDamp	Gradually changes a vector towards a desired goal over time.
>
>
>
>
> --
> View this message in context: http://forum.openscad.org/Can-you-suggest-some-libraries-of-standard-geometry-conversions-tp13900.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...