Skip to content
Browse files

to from plus igeo

  • Loading branch information...
1 parent e0b4b22 commit bbb412239cd4ce16b13f780d6c33e098597b12af @th0ma5w committed Feb 20, 2012
View
2 src/rosettamesh/anar.clj
@@ -21,6 +21,6 @@
(.ptList face)))
(.faces obj)))
-(defn -fromAnar [o] (fromAnar o))
(defn -toAnar [o] (toAnar o))
+(defn -fromAnar [o] (fromAnar o))
View
18 src/rosettamesh/hemesh.clj
@@ -8,14 +8,6 @@
(import '(wblut.geom.core WB_Point3d WB_ExplicitTriangle)
'(wblut.hemesh.creators HEC_FromTriangles))
-(defn fromHemesh [hemesh]
- (last (doall (list
- (.triangulate hemesh)
- (map (fn [a]
- (reverse (map (fn [b] (callList b x y z))
- (.getFaceVertices a) )) )
- (.getFacesAsArray hemesh))))))
-
(defn toHemesh [faceList]
(.create (doto (HEC_FromTriangles.)
(.setTriangles (into-array
@@ -26,6 +18,14 @@
face))
faceList)))))))
-(defn -fromHemesh [o] (fromHemesh o))
+(defn fromHemesh [hemesh]
+ (last (doall (list
+ (.triangulate hemesh)
+ (map (fn [a]
+ (reverse (map (fn [b] (callList b x y z))
+ (.getFaceVertices a) )) )
+ (.getFacesAsArray hemesh))))))
+
(defn -toHemesh [o] (toHemesh o))
+(defn -fromHemesh [o] (fromHemesh o))
View
26 src/rosettamesh/igeo.clj
@@ -1,18 +1,30 @@
(ns rosettamesh.igeo
(:gen-class
:name rosettamesh.igeo
- :methods [#^{:static true}[toIgeo [Object] java.util.ArrayList]
- #^{:static true}[fromIgeo [java.util.ArrayList] Object]])
+ :methods [#^{:static true}[toIgeo [Object] igeo.IMeshGeo]
+ #^{:static true}[fromIgeo [igeo.IMeshGeo] Object]])
(:use rosettamesh.util))
-(import '(processing.core PVector))
+(import '(igeo IMesh IFace IVertex))
(defn toIgeo [faceList]
-)
+ (.get (IMesh. (into-array (map
+ (fn [face]
+ ((fn [[a b c]] (IFace. a b c) )
+ (map
+ (fn [[x y z]] (IVertex. x y z))
+ face)))
+ faceList)))))
-(defn fromIgeo [obj]
-)
+(defn fromIgeo [ig]
+ (map
+ (fn [face]
+ (map
+ (fn [vertex] (callList vertex x y z))
+ (.vertices face)))
+ (.faces ig)))
-(defn -fromIgeo [o] (fromIgeo o))
(defn -toIgeo [o] (toIgeo o))
+(defn -fromIgeo [o] (fromIgeo o))
+
View
2 src/rosettamesh/processing.clj
@@ -20,6 +20,6 @@
face))
obj))
-(defn -fromProcessing [o] (fromProcessing o))
(defn -toProcessing [o] (toProcessing o))
+(defn -fromProcessing [o] (fromProcessing o))
View
16 src/rosettamesh/toxi.clj
@@ -7,20 +7,20 @@
(import '(toxi.geom Vec3D mesh.TriangleMesh))
-(defn fromToxi [toximesh]
- (map (fn [face]
- (map (fn [vertex]
- (callList vertex x y z))
- (callList face a b c)))
- (.faces toximesh)))
-
(defn toToxi [faceList]
(let [mesh (TriangleMesh.)
v3d (fn [[x y z]] (Vec3D. x y z))]
(last (map (fn [[a b c]]
(.addFace mesh (v3d a) (v3d b) (v3d c)))
faceList))))
-(defn -fromToxi [o] (fromToxi o))
+(defn fromToxi [toximesh]
+ (map (fn [face]
+ (map (fn [vertex]
+ (callList vertex x y z))
+ (callList face a b c)))
+ (.faces toximesh)))
+
(defn -toToxi [o] (toToxi o))
+(defn -fromToxi [o] (fromToxi o))
View
17 src/rosettamesh/unlekker.clj
@@ -8,13 +8,6 @@
(import '(unlekker.modelbuilder UGeometry UVec3)
'(processing.core PApplet))
-(defn fromModelBuilder [ugeom]
- (map (fn [face]
- (map (fn [vertex]
- (callList vertex x y z))
- (.v face)))
- (cleanNil (.face ugeom))))
-
(defn toModelBuilder [faceList]
(let [ugeom (UGeometry.)
uv3 (fn [[x y z]] (UVec3. x y z))]
@@ -25,6 +18,14 @@
(.endShape ugeom)
ugeom) )
-(defn -fromModelBuilder [o] (fromModelBuilder o))
+(defn fromModelBuilder [ugeom]
+ (map (fn [face]
+ (map (fn [vertex]
+ (callList vertex x y z))
+ (.v face)))
+ (cleanNil (.face ugeom))))
+
+
(defn -toModelBuilder [o] (toModelBuilder o))
+(defn -fromModelBuilder [o] (fromModelBuilder o))

0 comments on commit bbb4122

Please sign in to comment.
Something went wrong with that request. Please try again.