From 4925410a60b4d73348e523be1d498ad654fbd4cd Mon Sep 17 00:00:00 2001 From: Julia Longtin Date: Sun, 22 Feb 2026 21:21:58 +0000 Subject: [PATCH 1/2] use negate, rather than multiplying. --- Graphics/Implicit/ObjectUtil/GetImplicit2.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Graphics/Implicit/ObjectUtil/GetImplicit2.hs b/Graphics/Implicit/ObjectUtil/GetImplicit2.hs index 0425c4e3..9e6021f4 100644 --- a/Graphics/Implicit/ObjectUtil/GetImplicit2.hs +++ b/Graphics/Implicit/ObjectUtil/GetImplicit2.hs @@ -7,7 +7,7 @@ module Graphics.Implicit.ObjectUtil.GetImplicit2 (getImplicit2) where -import Prelude(cycle, (/=), uncurry, fst, Eq, zip, drop, abs, (-), (/), sqrt, (*), (+), length, fmap, (<=), (&&), (>=), (||), odd, ($), (>), filter, (<), minimum, (.), sin, cos) +import Prelude(cycle, negate, (/=), uncurry, fst, Eq, zip, drop, abs, (-), (/), sqrt, (*), (+), length, fmap, (<=), (&&), (>=), (||), odd, ($), (>), filter, (<), minimum, (.), sin, cos) import Graphics.Implicit.Definitions ( objectRounding, ObjectContext, SymbolicObj2(Square, Circle, Polygon, Rotate2, Slice, Transform2, Shared2), SharedObj (Empty), Obj2, ℝ2, ℝ ) @@ -54,11 +54,12 @@ getImplicit2 _ (Polygon (scanUniqueCircular -> points@(_:_:_:_))) = -- FIXME: use partition instead? seemsInRight = odd . length . filter (>0) $ nub crossing_points seemsInLeft = odd . length . filter (<0) $ nub crossing_points - isIn = seemsInRight && seemsInLeft dists :: [ℝ] dists = fmap (distFromLineSeg p) pairs in - minimum dists * if isIn then -1 else 1 + if seemsInRight && seemsInLeft + then negate $ minimum dists + else minimum dists getImplicit2 ctx (Polygon _) = getImplicitShared @SymbolicObj2 ctx Empty -- Simple transforms getImplicit2 ctx (Rotate2 θ symbObj) = From 4178b08eb0b65cad719d4ba31f5002087c34852a Mon Sep 17 00:00:00 2001 From: Julia Longtin Date: Sun, 22 Feb 2026 21:22:30 +0000 Subject: [PATCH 2/2] fix comment. --- Graphics/Implicit/Definitions.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Graphics/Implicit/Definitions.hs b/Graphics/Implicit/Definitions.hs index 5153e0dc..0f3e9f50 100644 --- a/Graphics/Implicit/Definitions.hs +++ b/Graphics/Implicit/Definitions.hs @@ -328,7 +328,7 @@ instance Monoid SymbolicObj2 where -- | A symbolic 3D format! data SymbolicObj3 = -- Primitives - Cube ℝ3 -- rounding, size. + Cube ℝ3 -- size | Sphere ℝ -- radius | Cylinder ℝ ℝ ℝ -- -- Simple transforms