Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delaunay triangulation #149

Closed
grav2itty opened this issue Oct 29, 2021 · 1 comment
Closed

Delaunay triangulation #149

grav2itty opened this issue Oct 29, 2021 · 1 comment

Comments

@grav2itty
Copy link

Hello. Im doing delaunay with random points in rational domain.
It works with 4 points. But with more points It mostly throws errors.
I also tried to do toPlaneGraph instead of toPlanarSubdivision and there are no errors
but the results does not seem correct (as if most of the points were ignored)
Tried both Naive and Dividie.
Ages ago I've reported problems with mutli polygon triangulation. Maybe that's similar problem.
Polygon triangulation works great for me so far with some pretty complex stuff I've thrown at it.

21> pointCount = 8
22> rvs <- replicateM pointCount (randomRIO (Point2 (-300) (-300), Point2 300 300))
23> ne = NE.fromList (ext . fmap (%(1::Integer)) <$> rvs)
24> trian = G.toPlanarSubdivision (Proxy :: Proxy ()) $ G.delaunayTriangulation ne
25> print (G.rawFacePolygons trian)
[(FaceId 1,Left SimplePolygon [Point2 (215 % 1) (242 % 1) :+ (),Point2 (127 % 1) (143 % 1) :+ (),Point2 (61 % 1) ((-84) % 1) :+ (),Point2 (217 % 1) ((-85) % 1) :+ (),Point2 (127 % 1) (143 % 1) :+ (),Point2 (215 % 1) (242 % 1) :+ (),Point2 (217 % 1) ((-85) % 1) :+ (),Point2 ((-40) % 1) ((-180) % 1) :+ (),Point2 ((-244) % 1) ((-202) % 1) :+ (),Point2 ((-278) % 1) (288 % 1) :+ ()] :+ ()),(FaceId 2,Left SimplePolygon [Point2 ((-244) % 1) ((-202) % 1) :+ (),Point2 ((-34) % 1) (2 % 1) :+ (),Point2 ((-40) % 1) ((-180) % 1) :+ (),Point2 (61 % 1) ((-84) % 1) :+ (),Point2 ((-34) % 1) (2 % 1) :+ (),Point2 ((-244) % 1) ((-202) % 1) :+ (),Point2 ((-40) % 1) ((-180) % 1) :+ (),Point2 ((-34) % 1) (2 % 1) :+ (),Point2 ((-278) % 1) (288 % 1) :+ ()] :+ ()),(FaceId 3,Left SimplePolygon [Point2 ((-34) % 1) (2 % 1) :+ (),Point2 (127 % 1) (143 % 1) :+ (),Point2 ((-278) % 1) (288 % 1) :+ ()] :+ ()),(FaceId 4,Left SimplePolygon [Point2 (217 % 1) ((-85) % 1) :+ (),Point2 (61 % 1) ((-84) % 1) :+ (),Point2 ((-40) % 1) ((-180) % 1) :+ ()] :+ ()),(FaceId 5,Left SimplePolygon [Point2 (61 % 1) ((-84) % 1) :+ (),Point2 (127 % 1) (143 % 1) :+ (),Point2 ((-34) % 1) (2 % 1) :+ ()] :+ ()),(FaceId 6,Left SimplePolygon *** Exception: (^?!): empty Fold
CallStack (from HasCallStack):
error, called at src/Control/Lens/Fold.hs:1310:28 in lens-4.18.1-IMnU2TgTkGFCqXrge7lTNW:Control.Lens.Fold
^?!, called at src/Data/PlanarGraph/Core.hs:435:32 in hgeometry-combinatorial-0.12.0.3-6MKt1QLJ2g4KHrJMCKbN5l:Data.PlanarGraph.Core

@noinia
Copy link
Owner

noinia commented Nov 7, 2021

Thanks for reporting! Apparently applying Data.Foldable.toList on a CircularList had some weird effect. This should be fixed by #153. Note that I also renamed some functions to clarify the behaviour. I.e. there is no more 'rawFacePolygons' but you can now explicitly use internalFacePolygons etc. :)

@noinia noinia closed this as completed Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants