Commit b3f1bada authored by Dave Cooper's avatar Dave Cooper
Browse files

added x3d support for spherical-cap

parent 5b06e69a
......@@ -15,7 +15,7 @@
:display-controls (list :color :brown)
:radius 3
:inner-radius 2.5
:end-horizontal-arc pi
;;:end-horizontal-arc pi
:start-vertical-arc 0
:end-vertical-arc (/ pi 4)
:center (translate (the center) :left 10 :rear 10 :up (the-child radius)))
......@@ -46,6 +46,15 @@
;;:arc pi
)
(reactor :type 'spherical-cap
:display-controls (list :color :purple )
:base-radius 3
:axis-length 2
:center (translate (the center)
:up (half (the-child height))
:left 17 :front 5))
(silo :type 'silo
:radius 1
......@@ -66,6 +75,7 @@
((roof :type 'sphere
:display-controls (list :color :orange)
:center (translate (the center) :rear (half (the length)))
:end-horizontal-arc pi
:pass-down (radius)
)
......
......@@ -135,7 +135,9 @@ the start and end point of the arc.
:arguments (angle \"Number in Radians\")"
point-on-arc
(angle)
(rotate-point (the start) (the center) (the (face-normal-vector :top)) :angle angle))))
(if (the start)
(rotate-point (the start) (the center) (the (face-normal-vector :top)) :angle angle)
(the center)))))
......
......@@ -21,7 +21,7 @@
(in-package :geom-base)
(define-object spherical-cap (arcoid-mixin base-object)
(define-object spherical-cap (ifs-output-mixin arcoid-mixin base-object)
:documentation (:description "The region of a sphere which lies above (or below) a given plane. Although this
could be created with a partial sphere using the sphere primitive, the spherical cap allows for more convenient
......@@ -67,7 +67,10 @@ construction and positioning since the actual center of the spherical cap is the
number-of-horizontal-sections 4)
("Integer. How many lines of longitude to show on the spherical-cap in some renderings. Default value is 2."
number-of-vertical-sections 4))
number-of-vertical-sections 4)
(inner? nil)
(closed? t))
:computed-slots
......@@ -125,12 +128,41 @@ construction and positioning since the actual center of the spherical cap is the
(push (list (if (typep (the :inner-cap) 'spherical-cap)
(the :inner-cap (:meridians count) :start)
(the :base-center))
(the (:meridians count) :start)) result)))))
(the (:meridians count) :start)) result))))
(polygon-points (mapcar #'(lambda(parallel)
(the-object parallel (equi-spaced-points (max (the number-of-vertical-sections) 12))))
(list-elements (the parallels))))
(polygons-for-ifs (let ((thickness? (and (not (the inner?)) (typep (the inner-cap) 'spherical-cap))))
(append (apply #'append
(mapcar #'(lambda(list1 list2)
(mapcar #'(lambda(p1 p2 p3 p4)
(list p1 p2 p4 p3))
list1 (rest list1) list2 (rest list2)))
(the polygon-points) (rest (the polygon-points))))
(when (and (not thickness?) (the closed?))
(list (first (the polygon-points))))
(when thickness? (the inner-cap polygons-for-ifs))
(when thickness?
(mapcar #'(lambda(p1 p2 p3 p4)
(list p1 p2 p4 p3))
(first (the polygon-points))
(rest (first (the polygon-points)))
(first (the inner-cap polygon-points))
(rest (first (the inner-cap polygon-points)))))))))
:hidden-objects
((inner-cap :type (if (and (the :inner-base-radius-c)
(the :cap-thickness-c)) 'spherical-cap 'null-part)
:base-radius (the :inner-base-radius-c)
:inner? t
:center (translate (the center) :down (half (the cap-thickness-c)))
:pass-down (:number-of-horizontal-sections :number-of-vertical-sections)
:axis-length (- (the :axis-length) (the :cap-thickness-c)))
......
......@@ -456,7 +456,7 @@
(cl-who:with-html-output (*stream* nil :indent t)
(:Shape
(:Appearance (write-the material-properties))
((:IndexedFaceSet :solid "false"
((:IndexedFaceSet :solid "FALSE"
:creaseAngle "1.571"
:coordIndex (format nil "~{~{~a~^ ~}~^ -1 ~}" (the ifs-indices)))
((:Coordinate :point (format nil "~{~{~a~^ ~}~^ ~}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment