This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
Interop support for opensolid/geometry and Zinggi/elm-webgl-math
version 1.0.0
license MPL-2.0
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.0.0
Committed At 2017-09-22 17:23:10 UTC
opensolid/geometry 2.0.1 <= v < 3.0.0 2.1.0
elm-lang/core 5.1.1 <= v < 6.0.0 5.1.1
Zinggi/elm-webgl-math 1.0.5 <= v < 2.0.0 1.0.6

README

opensolid/webgl-math-interop

This package supports interop between opensolid/geometry and Zinggi/elm-webgl-math. You can:

  • Convert opensolid/geometry Frame2d and Frame3d values to the equivalent elm-webgl-math Float3x3 and Float4x4 transformation matrices
  • Transform opensolid/geometry Point2d, Point3d, Vector2d and Vector3d values using elm-webgl-math Float3x3 and Float4x4 transformation matrices

You shouldn't need this package for general use - you should be able to do most geometric transformation you need (rotations, translations etc.) using OpenSolid itself. However, this package may be useful for other transformations such as shear or non-uniform scaling.

Note that the Float2 and Float3 types defined by elm-webgl-math are simply type aliases for tuples of floats, e.g.

type alias Float3 =
    ( Float, Float, Float )

Since those are exactly the same types used by functions like Point3d.fromCoordinates and Vector2d.components, conversion to and from opensolid/geometry point/vector/direction types is trivial; for example, use Point3d.coordinates to get a Float3 from a Point3d and use Point3d.fromCoordinates to convert a Float3 back to a Point3d.

Installation

elm package install opensolid/webgl-math-interop

Documentation

Full API documentation is available.

Usage details

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.WebGLMath.Point3d as Point3d

will let you use functions from both modules as if they were part of one big Point3d module. For example, you could use the transformBy 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.transformBy transformationMatrix Point3d.origin

Questions? Comments?

Please 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!