Skip to content

Commit

Permalink
First pass at subdivision surfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
kaveh808 committed Sep 6, 2023
1 parent a6a3d25 commit 4d9019b
Show file tree
Hide file tree
Showing 5 changed files with 498 additions and 0 deletions.
1 change: 1 addition & 0 deletions kons-9.asd
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
(:file "src/plugins/growth")
(:file "src/plugins/sprite")
(:file "src/plugins/poly-mesh")
(:file "src/plugins/subdiv-mesh")
(:file "src/plugins/usd")
(:file "src/plugins/obj")
(:file "src/plugins/stl")
Expand Down
3 changes: 3 additions & 0 deletions src/kernel/polyhedron.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
(setf (aref (point-normals polyh) n)
(p:normalize (aref (point-normals polyh) n)))))

(defmethod faces-num-points-refs ((polyh polyhedron))
(reduce #'+ (faces polyh) :key #'length))

(defmethod face-points-list ((polyh polyhedron) (i integer))
(mapcar (lambda (pref) (aref (points polyh) pref))
(aref (faces polyh) i)))
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/poly-mesh.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

;;; half edge data structures for topological operations on meshes
;;; http://what-when-how.com/advanced-methods-in-computer-graphics/mesh-processing-advanced-methods-in-computer-graphics-part-2/
;;;
;;; https://onrendering.com/data/papers/catmark/HalfedgeCatmullClark.pdf

(defclass pm-vertex ()
((point :accessor point :initarg :point :initform (p! 0 0 0))
Expand Down
Loading

0 comments on commit 4d9019b

Please sign in to comment.