3.0.0
elm-geometry
3.0 is out! This release brings some small but breaking changes from the interim 2.0 release, and should hopefully now be stable for the foreseeable future.
Block3d
elm-geometry
now has a Block3d
type which is basically a 3D version of Rectangle2d
, useful for defining rectangular blocks in 3D. Unlike a BoundingBox3d
, a Block3d
does not have to be axis-aligned - it can be arbitrarily rotated, mirrored and otherwise transformed).
Bounding box constructor changes
A few bounding box related functions have been moved around/renamed for clarity/discoverability, with the end result that they're actually a bit closer to where they used to be in elm-geometry
1.x. Specifically:
- Most of the existing bounding box
hull
functions have been renamed toaggregate
; for exampleBoundingBox2d.hull3
is nowBoundingBox2d.aggregate3
. - The existing
BoundingBox2d.hull2
andBoundingBox3d.hull2
functions have been renamed tounion
(not strictly the correct term mathematically speaking, but convenient). - Most of the existing point
hull
functions have been moved to the corresponding bounding box modules; for examplePoint3d.hull
is nowBoundingBox3d.hull
(with the same signature). - The existing
Point2d.hull2
andBoundingBox3d.hull2
have been moved/renamed toBoundingBox2d.from
andBoundingBox3d.from
(matching how things worked in 1.x).
Basically, all functions that construct bounding boxes are now in bounding box modules. In addition, hullOfN
and aggregateOfN
functions have been added that basically act as combinations of hullOf
/hullN
and aggregateOf
/aggregateN
respectively.
See #107 for relevant discussion - thanks @MartinSStewart!
Miscellaneous
- The
Arc.SweptAngle
has been renamed to simplySweptAngle
for simplicity (didn't seem like that was likely to cause too many module name conflicts). - There is now an
Axis3d.intersectionWithPlane
function to find the intersection of an axis and a plane in 3D. - The
Circle2d
andSphere3d
modules now have some convenientatPoint
andatOrigin
constructors. - The
LineSegment2d
andLineSegment3d
modules now havefromPointAndVector
constructors as suggested in #110. - The type signatures of
Frame2d.atOrigin
andFrame3d.atOrigin
have been loosened slightly to matchFrame2d.atPoint Point2d.origin
andFrame3d.atPoint Point3d.atOrigin
; this was a case where the initial design was a bit too strict about coordinate system tracking and prevented some perfectly valid code from compiling. Thanks @unsoundscapes for some useful feedback here! Rectangle2d.withAxes
has been renamed back toRectangle2d.centeredOn
; I've gone back and forth on this one but I thinkcenteredOn
is more descriptive and readable.
Full diff
I think all the changes in 3.0 have been discussed above, but I may have missed something! Here's what elm diff
reported for elm-geometry
3.0 relative to 2.0:
---- ADDED MODULES - MINOR ----
Block3d
SweptAngle
---- REMOVED MODULES - MAJOR ----
Arc.SweptAngle
---- Axis3d - MINOR ----
Added:
intersectionWithPlane :
Geometry.Types.Plane3d units coordinates
-> Axis3d.Axis3d units coordinates
-> Maybe.Maybe (Point3d.Point3d units coordinates)
---- BoundingBox2d - MAJOR ----
Added:
aggregate :
BoundingBox2d.BoundingBox2d units coordinates
-> List.List (BoundingBox2d.BoundingBox2d units coordinates)
-> BoundingBox2d.BoundingBox2d units coordinates
aggregate3 :
BoundingBox2d.BoundingBox2d units coordinates
-> BoundingBox2d.BoundingBox2d units coordinates
-> BoundingBox2d.BoundingBox2d units coordinates
-> BoundingBox2d.BoundingBox2d units coordinates
aggregateN :
List.List (BoundingBox2d.BoundingBox2d units coordinates)
-> Maybe.Maybe (BoundingBox2d.BoundingBox2d units coordinates)
aggregateOf :
(a -> BoundingBox2d.BoundingBox2d units coordinates)
-> a
-> List.List a
-> BoundingBox2d.BoundingBox2d units coordinates
aggregateOfN :
(a -> BoundingBox2d.BoundingBox2d units coordinates)
-> List.List a
-> Maybe.Maybe (BoundingBox2d.BoundingBox2d units coordinates)
from :
Point2d.Point2d units coordinates
-> Point2d.Point2d units coordinates
-> BoundingBox2d.BoundingBox2d units coordinates
hullOfN :
(a -> Point2d.Point2d units coordinates)
-> List.List a
-> Maybe.Maybe (BoundingBox2d.BoundingBox2d units coordinates)
union :
BoundingBox2d.BoundingBox2d units coordinates
-> BoundingBox2d.BoundingBox2d units coordinates
-> BoundingBox2d.BoundingBox2d units coordinates
Removed:
hull2 :
BoundingBox2d units coordinates
-> BoundingBox2d units coordinates
-> BoundingBox2d units coordinates
Changed:
- hull :
BoundingBox2d units coordinates
-> List (BoundingBox2d units coordinates)
-> BoundingBox2d units coordinates
+ hull :
Point2d.Point2d units coordinates
-> List.List (Point2d.Point2d units coordinates)
-> BoundingBox2d.BoundingBox2d units coordinates
- hull3 :
BoundingBox2d units coordinates
-> BoundingBox2d units coordinates
-> BoundingBox2d units coordinates
-> BoundingBox2d units coordinates
+ hull3 :
Point2d.Point2d units coordinates
-> Point2d.Point2d units coordinates
-> Point2d.Point2d units coordinates
-> BoundingBox2d.BoundingBox2d units coordinates
- hullN :
List (BoundingBox2d units coordinates)
-> Maybe (BoundingBox2d units coordinates)
+ hullN :
List.List (Point2d.Point2d units coordinates)
-> Maybe.Maybe (BoundingBox2d.BoundingBox2d units coordinates)
- hullOf :
(a -> BoundingBox2d units coordinates)
-> a
-> List a
-> BoundingBox2d units coordinates
+ hullOf :
(a -> Point2d.Point2d units coordinates)
-> a
-> List.List a
-> BoundingBox2d.BoundingBox2d units coordinates
---- BoundingBox3d - MAJOR ----
Added:
aggregate :
BoundingBox3d.BoundingBox3d units coordinates
-> List.List (BoundingBox3d.BoundingBox3d units coordinates)
-> BoundingBox3d.BoundingBox3d units coordinates
aggregate3 :
BoundingBox3d.BoundingBox3d units coordinates
-> BoundingBox3d.BoundingBox3d units coordinates
-> BoundingBox3d.BoundingBox3d units coordinates
-> BoundingBox3d.BoundingBox3d units coordinates
aggregateN :
List.List (BoundingBox3d.BoundingBox3d units coordinates)
-> Maybe.Maybe (BoundingBox3d.BoundingBox3d units coordinates)
aggregateOf :
(a -> BoundingBox3d.BoundingBox3d units coordinates)
-> a
-> List.List a
-> BoundingBox3d.BoundingBox3d units coordinates
aggregateOfN :
(a -> BoundingBox3d.BoundingBox3d units coordinates)
-> List.List a
-> Maybe.Maybe (BoundingBox3d.BoundingBox3d units coordinates)
from :
Point3d.Point3d units coordinates
-> Point3d.Point3d units coordinates
-> BoundingBox3d.BoundingBox3d units coordinates
hullOfN :
(a -> Point3d.Point3d units coordinates)
-> List.List a
-> Maybe.Maybe (BoundingBox3d.BoundingBox3d units coordinates)
union :
BoundingBox3d.BoundingBox3d units coordinates
-> BoundingBox3d.BoundingBox3d units coordinates
-> BoundingBox3d.BoundingBox3d units coordinates
Removed:
hull2 :
BoundingBox3d units coordinates
-> BoundingBox3d units coordinates
-> BoundingBox3d units coordinates
Changed:
- hull :
BoundingBox3d units coordinates
-> List (BoundingBox3d units coordinates)
-> BoundingBox3d units coordinates
+ hull :
Point3d.Point3d units coordinates
-> List.List (Point3d.Point3d units coordinates)
-> BoundingBox3d.BoundingBox3d units coordinates
- hull3 :
BoundingBox3d units coordinates
-> BoundingBox3d units coordinates
-> BoundingBox3d units coordinates
-> BoundingBox3d units coordinates
+ hull3 :
Point3d.Point3d units coordinates
-> Point3d.Point3d units coordinates
-> Point3d.Point3d units coordinates
-> BoundingBox3d.BoundingBox3d units coordinates
- hullN :
List (BoundingBox3d units coordinates)
-> Maybe (BoundingBox3d units coordinates)
+ hullN :
List.List (Point3d.Point3d units coordinates)
-> Maybe.Maybe (BoundingBox3d.BoundingBox3d units coordinates)
- hullOf :
(a -> BoundingBox3d units coordinates)
-> a
-> List a
-> BoundingBox3d units coordinates
+ hullOf :
(a -> Point3d.Point3d units coordinates)
-> a
-> List.List a
-> BoundingBox3d.BoundingBox3d units coordinates
---- Circle2d - MINOR ----
Added:
atOrigin :
Quantity.Quantity Basics.Float units
-> Circle2d.Circle2d units coordinates
atPoint :
Point2d.Point2d units coordinates
-> Quantity.Quantity Basics.Float units
-> Circle2d.Circle2d units coordinates
---- Frame2d - MAJOR ----
Changed:
- atOrigin : Frame2d units coordinates { defines : coordinates }
+ atOrigin : Frame2d.Frame2d units coordinates defines
---- Frame3d - MAJOR ----
Changed:
- atOrigin : Frame3d units coordinates { defines : coordinates }
+ atOrigin : Frame3d.Frame3d units coordinates defines
---- LineSegment2d - MINOR ----
Added:
fromPointAndVector :
Point2d.Point2d units coordinates
-> Vector2d.Vector2d units coordinates
-> LineSegment2d.LineSegment2d units coordinates
---- LineSegment3d - MINOR ----
Added:
fromPointAndVector :
Point3d.Point3d units coordinates
-> Vector3d.Vector3d units coordinates
-> LineSegment3d.LineSegment3d units coordinates
---- Point2d - MAJOR ----
Removed:
hull :
Point2d units coordinates
-> List (Point2d units coordinates)
-> BoundingBox2d units coordinates
hull2 :
Point2d units coordinates
-> Point2d units coordinates
-> BoundingBox2d units coordinates
hull3 :
Point2d units coordinates
-> Point2d units coordinates
-> Point2d units coordinates
-> BoundingBox2d units coordinates
hullN :
List (Point2d units coordinates)
-> Maybe (BoundingBox2d units coordinates)
hullOf :
(a -> Point2d units coordinates)
-> a
-> List a
-> BoundingBox2d units coordinates
---- Point3d - MAJOR ----
Removed:
hull :
Point3d units coordinates
-> List (Point3d units coordinates)
-> BoundingBox3d units coordinates
hull2 :
Point3d units coordinates
-> Point3d units coordinates
-> BoundingBox3d units coordinates
hull3 :
Point3d units coordinates
-> Point3d units coordinates
-> Point3d units coordinates
-> BoundingBox3d units coordinates
hullN :
List (Point3d units coordinates)
-> Maybe (BoundingBox3d units coordinates)
hullOf :
(a -> Point3d units coordinates)
-> a
-> List a
-> BoundingBox3d units coordinates
---- Rectangle2d - MAJOR ----
Added:
centeredOn :
Frame2d.Frame2d units coordinates defines
-> ( Quantity.Quantity Basics.Float units
, Quantity.Quantity Basics.Float units
)
-> Rectangle2d.Rectangle2d units coordinates
Removed:
withAxes :
Frame2d units coordinates defines
-> ( Quantity Float units, Quantity Float units )
-> Rectangle2d units coordinates
---- Sphere3d - MINOR ----
Added:
atOrigin :
Quantity.Quantity Basics.Float units
-> Sphere3d.Sphere3d units coordinates
atPoint :
Point3d.Point3d units coordinates
-> Quantity.Quantity Basics.Float units
-> Sphere3d.Sphere3d units coordinates