This package supports interop between opensolid/geometry
and elm-community/linear-algebra.
You can:
- Convert
opensolid/geometryPoint2d,Point3d,Vector2d,Vector3d,Direction2dandDirection3dvalues to and fromlinear-algebraVec2,Vec3andVec4values - Convert
opensolid/geometryFrame3dvalues to the equivalentlinear-algebraMat4transformation matrices - Transform
opensolid/geometryPoint3dandVector3dvalues usinglinear-algebraMat4transformation matrices
This is important for working with WebGL, since the elm-community/webgl
package requires using linear-algebra types when defining meshes and shaders.
This package may also be useful when using other packages that accept or return
linear-algebra types, such as mkovacs/quaternion.
However, you shouldn't need this package for general use - you should be able to
do most geometric transformations you need (rotations, translations etc.) using
OpenSolid itself.
elm package install opensolid/linear-algebra-interop
Full API documentation is available.
The modules in this package are all designed to be imported using as to
'merge' them with the base OpenSolid modules; for example, using
import OpenSolid.Point3d as Point3d exposing (Point3d)
import OpenSolid.Interop.LinearAlgebra.Point3d as Point3dwill let you use functions from both modules as if they were part of one big
Point3d module. For example, you could use the toVec3 function from this
package's Point3d module with the origin value from the base Point3d
module as if they were part of the same module:
Point3d.toVec3 Point3d.origin
--> Math.Vector3.vec3 0 0 0Please open a new issue if you run into a bug, if any documentation is missing/incorrect/confusing, or if there's a new feature that you would find useful. For general questions about using this package, try:
- Sending me (@ianmackenzie) a message on the Elm Slack - even if you don't have any particular questions right now, just come say hello!
- Posting to the r/elm subreddit
- Posting to the elm-discuss Google Group (somewhat less active than Slack and Reddit, but I still follow it regularly if you prefer e-mail)
- Or if you happen to be in the New York area, come on out to the Elm NYC meetup =)
You can also find me on Twitter (@ianemackenzie), where I occasionally post OpenSolid-related stuff like demos or new releases. Have fun, and don't be afraid to ask for help!