-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Begin porting things to vector-space
This follows the approach taken in Brent Yorgey's diagrams package, using Conal Elliott's vector-space classes. This allows us to get rid of the rather unidiomatic and arguably overly-polymorphic Graphics.Implicit.SaneOperators. Since this has been removed, we can now begin pulling out the many type annotations strewn about the codebase. The recently introduced Criterion benchmark confirms that this has no measurable effect on performance, Before After Object 1/STL write 235.7 ± 9.3 ms 236.0 ± 12.8 ms Object 2/STL write 1.54 ± 0.99 ms 1.44 ± 0.28 us Note that I make no attempt to enforce any separate between AffineSpaces and VectorSpaces here. This is work for a later patch. Additionally, a small performance gain may be had by strictifying and unpacking the fields of R3 and R2. This, however, would require that a `data` type be defined and all packing/unpacking of vectors would need to happen with the appropriate data constructor. Given this is even more invasive a change than the current patch, this is left as future work. Conflicts: Graphics/Implicit/Export/RayTrace.hs Graphics/Implicit/ObjectUtil/GetImplicit3.hs
- Loading branch information
Showing
18 changed files
with
145 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
module Graphics.Implicit.Export.Symbolic.Rebound2 (rebound2) where | ||
|
||
import Data.VectorSpace | ||
import Graphics.Implicit.Definitions | ||
import qualified Graphics.Implicit.SaneOperators as S | ||
|
||
rebound2 :: BoxedObj2 -> BoxedObj2 | ||
rebound2 (obj, (a,b)) = | ||
let | ||
d :: ℝ2 | ||
d = (b S.- a) S./ (10.0 :: ℝ) | ||
d = (b ^-^ a) ^/ 10 | ||
in | ||
(obj, ((a S.- d), (b S.+ d))) | ||
(obj, ((a ^-^ d), (b ^+^ d))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
module Graphics.Implicit.Export.Symbolic.Rebound3 (rebound3) where | ||
|
||
import Graphics.Implicit.Definitions | ||
import qualified Graphics.Implicit.SaneOperators as S | ||
import Data.VectorSpace | ||
|
||
rebound3 :: BoxedObj3 -> BoxedObj3 | ||
rebound3 (obj, (a,b)) = | ||
let | ||
d :: ℝ3 | ||
d = (b S.- a) S./ (10.0 :: ℝ) | ||
d = (b ^-^ a) ^/ 10 | ||
in | ||
(obj, ((a S.- d), (b S.+ d))) | ||
(obj, ((a ^-^ d), (b ^+^ d))) | ||
|
Oops, something went wrong.