Skip to content

Commit

Permalink
[types] refactor PRotate/PScale/PTransform protocol impls for LineStr…
Browse files Browse the repository at this point in the history
…ip2/3
  • Loading branch information
postspectacular committed Mar 29, 2015
1 parent 9c837f8 commit 363dddf
Showing 1 changed file with 15 additions and 57 deletions.
72 changes: 15 additions & 57 deletions geom-types/src/line.org
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
- [[#ptransform][PTransform]]
- [[#pvolume][PVolume]]
- [[#end-of-implementations][End of implementations]]
- [[#todo-linestrip2][TODO LineStrip2]]
- [[#linestrip2][LineStrip2]]
- [[#protocol-implementations][Protocol implementations]]
- [[#parea][PArea]]
- [[#todo-pboundary][TODO PBoundary]]
Expand All @@ -75,7 +75,7 @@
- [[#ptransform][PTransform]]
- [[#pvolume][PVolume]]
- [[#end-of-implementations][End of implementations]]
- [[#todo-linestrip3][TODO LineStrip3]]
- [[#linestrip3][LineStrip3]]
- [[#protocol-implementations][Protocol implementations]]
- [[#parea][PArea]]
- [[#todo-pboundary][TODO PBoundary]]
Expand Down Expand Up @@ -485,7 +485,7 @@ further below.
#+BEGIN_SRC clojure :noweb-ref impl3
)
#+END_SRC
** TODO LineStrip2
** LineStrip2
*** Protocol implementations
#+BEGIN_SRC clojure :noweb-ref impl-ls2
(extend-type thi.ng.geom.types.LineStrip2
Expand Down Expand Up @@ -603,28 +603,11 @@ further below.
(gu/sample-uniform udist include-last? (:points _)))
#+END_SRC
**** PTransform
#+BEGIN_SRC clojure :noweb-ref impl-ls2
g/PRotate
(rotate
[_ theta]
(thi.ng.geom.types.LineStrip2. (mapv #(g/rotate % theta) (:points _))))
g/PScale
(scale
([_ s]
(thi.ng.geom.types.LineStrip2. (mapv #(g/* % s) (:points _))))
([_ sx sy]
(thi.ng.geom.types.LineStrip2. (mapv #(g/* % sx sy) (:points _)))))
(scale-size
[_ s]
(thi.ng.geom.types.LineStrip2. (gu/scale-size s (:points _))))
g/PTranslate
(translate
[_ t]
(thi.ng.geom.types.LineStrip2. (mapv #(g/+ % t) (:points _))))
g/PTransform
(transform
[_ m]
(thi.ng.geom.types.LineStrip2. (mapv #(g/transform-vector m %) (:points _))))
#+BEGIN_SRC clojure :noweb-ref impl-ls2 :noweb yes
<<lob-geom-rotate(type="thi.ng.geom.types.LineStrip2")>>
<<lob-geom-scale(type="thi.ng.geom.types.LineStrip2")>>
<<lob-geom-translate(type="thi.ng.geom.types.LineStrip2")>>
<<lob-geom-tx(type="thi.ng.geom.types.LineStrip2")>>
#+END_SRC
**** PVolume
#+BEGIN_SRC clojure :noweb-ref impl-ls2 :noweb yes
Expand All @@ -636,7 +619,7 @@ further below.
)
#+END_SRC

** TODO LineStrip3
** LineStrip3
*** Protocol implementations
#+BEGIN_SRC clojure :noweb-ref impl-ls3
(extend-type thi.ng.geom.types.LineStrip3
Expand Down Expand Up @@ -754,37 +737,12 @@ further below.
(gu/sample-uniform udist include-last? (:points _)))
#+END_SRC
**** PTransform
#+BEGIN_SRC clojure :noweb-ref impl-ls3
g/PRotate
(rotate-around-axis
[_ axis theta]
(thi.ng.geom.types.LineStrip3. (mapv #(g/rotate-around-axis % axis theta) (:points _))))
(rotate-x
[_ theta]
(thi.ng.geom.types.LineStrip3. (mapv #(g/rotate-x % theta) (:points _))))
(rotate-y
[_ theta]
(thi.ng.geom.types.LineStrip3. (mapv #(g/rotate-y % theta) (:points _))))
(rotate-z
[_ theta]
(thi.ng.geom.types.LineStrip3. (mapv #(g/rotate-z % theta) (:points _))))
g/PScale
(scale
([_ s]
(thi.ng.geom.types.LineStrip3. (mapv #(g/* % s) (:points _))))
([_ sx sy]
(thi.ng.geom.types.LineStrip3. (mapv #(g/* % sx sy) (:points _)))))
(scale-size
[_ s]
(thi.ng.geom.types.LineStrip3. (gu/scale-size s (:points _))))
g/PTranslate
(translate
[_ t]
(thi.ng.geom.types.LineStrip3. (mapv #(g/+ % t) (:points _))))
g/PTransform
(transform
[_ m]
(thi.ng.geom.types.LineStrip3. (mapv #(g/transform-vector m %) (:points _))))
#+BEGIN_SRC clojure :noweb-ref impl-ls3 :noweb yes
<<lob-geom-rotate(type="thi.ng.geom.types.LineStrip3")>>
<<lob-geom-rotate3d(type="thi.ng.geom.types.LineStrip3")>>
<<lob-geom-scale(type="thi.ng.geom.types.LineStrip3")>>
<<lob-geom-translate(type="thi.ng.geom.types.LineStrip3")>>
<<lob-geom-tx(type="thi.ng.geom.types.LineStrip3")>>
#+END_SRC
**** PVolume
#+BEGIN_SRC clojure :noweb-ref impl-ls3 :noweb yes
Expand Down

0 comments on commit 363dddf

Please sign in to comment.