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

added some boolean to primi-plane

parent f61024d5
......@@ -8,22 +8,47 @@
:Tmax 800
:rho 0.73
:C-of-F 0.005
;;
;; Fuselage data
;;
:fuselage-diameter 5
:fuselage-length 42
;;
;; Fuselage cross section percentages - plist with keys percent of
;; length, values percent of full cylinder diameter
;;
:fuselage-cross-section-percents (0 10
10 90
20 100
30 100
40 100
50 100
60 100
70 100
80 100
90 90
100 10)
:tail-span
15
;;
;; Tail data
;;
:tail-span 15
:tail-c-root 5
:tail-c-tip 2
:tail-thickness 0.8
:tail-dihedral 8
:rudder-span
10
;;
;; Rudder data
;;
:rudder-span 10
:rudder-c-root 5
:rudder-c-tip 2
:rudder-thickness 0.8
)
......@@ -63,12 +63,12 @@
:c-tip (the data tail-c-tip)
:span (the data tail-span)
:root-center (translate (the center)
:down (- (the fuselage radius) (half (the-child thickness)))
:down (- (the fuselage radius) (the-child thickness))
:rear (- (half (the fuselage length))
(half (the-child c-root))))
(the-child c-root)))
:rudder-root-center (translate (the-child root-center) :up
(- (twice (the fuselage radius))
(half (the-child thickness))))
(twice (the-child thickness))))
:thickness (the data tail-thickness)
:dihedral (the data tail-dihedral)
:rudder-span (the data rudder-span)
......@@ -82,6 +82,7 @@
(fuselage :type 'cylinder-fuselage
:d (the data fuselage-diameter)
:l (the data fuselage-length)
:cross-section-percents (the data fuselage-cross-section-percents)
:display-controls (list :color :red)
)))
......@@ -90,6 +91,7 @@
:input-slots (wing-span wing-thickness wing-dihedral
wing-c-root wing-c-tip Tmax rho C-of-F
fuselage-diameter fuselage-length
fuselage-cross-section-percents
tail-c-root tail-c-tip tail-span
tail-thickness tail-dihedral
points-data
......@@ -124,10 +126,81 @@
(define-object cylinder-fuselage (cylinder)
:input-slots (d l)
:input-slots (d l cross-section-percents)
:computed-slots ((radius (half (the d)))
(length (the l))))
(length (the l))
(section-offset-percentages (plist-keys (the cross-section-percents)))
(section-centers (let ((nose-point (translate (the center) :front (half (the length)))))
(mapcar #'(lambda (percentage)
(translate nose-point :rear
(* 1/100 percentage (the length))))
(the section-offset-percentages))))
(section-diameter-percentages (plist-values (the cross-section-percents)))
(section-radii (mapcar #'(lambda (percentage)
(* 1/100 percentage (the radius)))
(the section-diameter-percentages))))
:objects ((regioned :type 'regioned-solid
:display-controls (list :transparency 0.5)
:brep (the merged))
(interior :type 'cabin-interior
:display-controls (list :color :black)
:width (twice (the radius))))
:hidden-objects ((section-curves :type 'arc-curve
:sequence (:size (length (the section-centers)))
:center (nth (the-child index) (the section-centers))
:radius (nth (the-child index) (the section-radii))
:orientation (alignment :top (the (face-normal-vector :front))))
(floor-plane :type 'rectangular-surface
:display-controls (list :color :black)
:width (* (the radius) 4)
:length (* (the length) 3/2))
(merged :type 'merged-solid
:brep (the loft brep)
:other-brep (the floor-plane brep)
:make-manifold? t)
(loft :type 'lofted-surface
:end-caps-on-brep? t
:curves (list-elements (the section-curves)))))
(define-object cabin-interior (base-object)
:computed-slots ((nose-point (translate (the center)
:front (- (half (the length))
(* 1/10 (the length))))))
:objects
((seat-rows :type 'seat-row
:sequence (:size (floor (/ (* 8/10 (the length)) 2)))
:length 1
:height 1
:width (* .8 (the width))
:center (translate (the nose-point)
:rear (* (twice (the-child length))
(the-child index))
:up (half (the-child height))))))
(define-object seat-row (base-object)
:objects
((seats :type 'box
:width 0.5
:sequence (:matrix :lateral 5 :longitudinal 1))))
(define-object box-wings (base-object)
:input-slots (root-center span c-root c-tip thickness dihedral canonical-profile)
......@@ -186,7 +259,7 @@
:objects ((box :type 'box
:hidden? t
:display-controls (list :color :yellow :transparency 0.7))
:display-controls (list :color :orange :transparency 0.7))
(root-profile :type 'boxed-curve
......@@ -197,7 +270,8 @@
:scale-y (/ (the thickness) (the canonical-profile max-thickness))
:scale-x (/ (the c-root) (the canonical-profile chord))
:center (the (edge-center :left :front))
:hidden? t)
:hidden? t
)
(tip-profile :type 'boxed-curve
:curve-in (the canonical-profile)
......@@ -208,8 +282,12 @@
:scale-x (/ (the c-tip) (the canonical-profile chord))
:center (translate (the (edge-center :right :front))
:rear (- (the length) (the c-tip)))
:hidden? t)
:hidden? t
)
(loft :type 'lofted-surface
:end-caps-on-brep? t
:curves (list (the root-profile) (the tip-profile)))))
(setq *tess-max-3d-edge-factor* 0.3)
(setq *tess-max-angle-degrees* 25)
\ No newline at end of file
;;
;; Copyright 2002-2011 Genworks International and Genworks BV
;; Copyright 2012 Genworks International
;;
;; This source file is part of the General-purpose Declarative
;; Language project (GDL).
......
;;
;; Copyright 2002-2011, 2012 Genworks International
;; Copyright 2012 Genworks International
;;
;; This source file is part of the General-purpose Declarative
;; Language project (GDL).
......@@ -144,10 +144,10 @@
(cl-who:with-html-output (*stream* nil :indent nil)
(:|Transform| :translation (when (not (every #'zerop (list x y z)))
(format nil "~3,7f ~3,7f ~3,7f" x y z))
:rotation (when rotation
(format nil "~3,7f ~3,7f ~3,7f ~3,7f" (get-x rotation) (get-y rotation) (get-z rotation) (get-w rotation)))
(:|Group| (write-the shape))))))
(format nil "~3,7f ~3,7f ~3,7f" x y z))
:rotation (when rotation
(format nil "~3,7f ~3,7f ~3,7f ~3,7f" (get-x rotation) (get-y rotation) (get-z rotation) (get-w rotation)))
(:|Group| (write-the shape))))))
(scene
()
......@@ -190,8 +190,11 @@
(write-the shape)))
(write-the shape)))
(when (and (typep self 'outline-specialization-mixin)
(not (ignore-errors (typep self (read-from-string "surf:surface")))))
(not (ignore-errors (typep self (read-from-string "surf:surface"))))
(not (ignore-errors (typep self (read-from-string "surf:curve")))))
(let* ((center (reverse-vector (the center)))
(x (get-x center)) (y (get-y center)) (z (get-z center))
(inverse (when (the orientation*)
......@@ -240,10 +243,12 @@
(mapc #'(lambda(child)
(write-the-object child (cad-output-tree :header? nil :from-root? nil))) (the children)))
(when (and (typep self 'outline-specialization-mixin)
(not (ignore-errors (typep self (read-from-string "surf:surface")))))
(not (ignore-errors (typep self (read-from-string "surf:surface"))))
(not (ignore-errors (typep self (read-from-string "surf:curve")))))
(let* ((center (reverse-vector (the center)))
(x (get-x center)) (y (get-y center)) (z (get-z center))
(inverse (when (the orientation*)
......@@ -262,7 +267,20 @@
(defmacro with-corrected-orientation (&body body)
`(let* ((orientation (when (the orientation*)
(alignment :rear (the (face-normal-vector :rear))
:top (the (face-normal-vector :bottom))
:right (the (face-normal-vector :right)))))
(local (when orientation
(matrix:multiply-matrix orientation (matrix:transpose-matrix (the orientation*)))))
(rotation (when local (matrix-to-rotation local))))
(cl-who:with-html-output (*stream* nil :indent t)
(:|Transform| :rotation (when rotation (format nil "~3,7f ~3,7f ~3,7f ~3,7f" (get-x rotation) (get-y rotation) (get-z rotation) (get-w rotation)))
,@body))))
(define-lens (x3d line)()
......@@ -285,8 +303,6 @@
(define-lens (x3d arc)()
:output-functions
((shape
......@@ -327,20 +343,19 @@
(get-z point))) points))))))))))))
(define-lens (x3d cone)()
:output-functions
(
(shape
()
(if (the simple?)
(cl-who:with-html-output (*stream* nil :indent nil)
(:|Shape|
(:|Appearance| (write-the material-properties))
(:|Cone| :bottomRadius (the radius-1)
:topRadius (the radius-2)
:height (the length)
:bottom (when (the bottom-cap?) "TRUE"))))
(with-corrected-orientation
(:|Shape|
(:|Appearance| (write-the material-properties))
(:|Cone| :bottomRadius (the radius-1)
:topRadius (the radius-2)
:height (the length)
:bottom (when (the bottom-cap?) "TRUE"))))
(call-next-method)))))
......@@ -361,6 +376,9 @@
;;
;; FLAG -- why doesn't this need the corrected-orientation?
;;
(define-lens (x3d cylinder)()
:output-functions
(
......@@ -369,9 +387,9 @@
(if (the simple?)
(cl-who:with-html-output (*stream* nil :indent nil)
(:|Shape|
(:|Appearance| (write-the material-properties))
(:|Cylinder| :|radius| (to-double-float (the radius) )
:|height| (to-double-float (the length)))))
(:|Appearance| (write-the material-properties))
(:|Cylinder| :|radius| (to-double-float (the radius))
:|height| (to-double-float (the length)))))
(call-next-method)))))
......@@ -379,13 +397,13 @@
:output-functions
((shape
()
(cl-who:with-html-output (*stream* nil :indent t)
(:|Shape|
(:|Appearance| (write-the material-properties))
(:|Box| :|size| (format nil "~a ~a ~a"
(to-double-float (the width))
(to-double-float (the length))
(to-double-float (the height)))))))))
(with-corrected-orientation
(:|Shape|
(:|Appearance| (write-the material-properties))
(:|Box| :|size| (format nil "~a ~a ~a"
(to-double-float (the width))
(to-double-float (the length))
(to-double-float (the height)))))))))
......@@ -424,8 +442,8 @@
(coerce (get-y point) 'single-float)
(coerce (get-z point) 'single-float)
))
(the vertex-list)))))))))))
(mapcar #'(lambda(point) (the (global-to-local* point)))
(the vertex-list))))))))))))
(define-lens (x3d ifs-output-mixin)()
:output-functions
......@@ -443,3 +461,4 @@
(list (get-x point) (get-y point) (get-z point))) )
(the ifs-array)))))))))))
;;
;; Copyright 2002-2011, 2012 Genworks International
;; Copyright 2012 Genworks International
;;
;; This source file is part of the General-purpose Declarative
;; Language project (GDL).
......@@ -59,7 +59,7 @@
(when (getf (the display-controls) :linetype)
(write-the line-properties))))
(:IndexedFaceSet :creaseAngle "1.571"
:solid "false"
:solid "true"
:coordIndex formatted-vertices
(:Coordinate :point (format nil "~{~a~^, ~}"
(let ((*read-default-float-format* 'single-float))
......@@ -76,7 +76,8 @@
:output-functions
((shape
()
(let* ((total-points (floor (the total-length)))
(let* ((total-points *curve-chords* ;;(floor (the total-length))
)
(points (the (equi-spaced-points total-points)))
(3d-points (mapcar #'(lambda(point) (the (global-to-local* point))) points)))
(let ((indices (list-of-numbers 0 (1- (length points)))))
......@@ -84,13 +85,13 @@
(:|Shape|
(:|Appearance| (write-the material-properties))
(:|IndexedLineSet| :|coordIndex| (format nil "~{~a ~}-1" indices)
(:|Coordinate| :|point| (format nil "~{~a~^, ~}"
(let ((*read-default-float-format* 'single-float))
(mapcar #'(lambda(point)
(format nil "~a ~a ~a"
(coerce (get-x point) 'single-float)
(coerce (get-y point) 'single-float)
(coerce (get-z point) 'single-float)))
3d-points))))))))))))
(:|Coordinate| :|point| (format nil "~{~a~^, ~}"
(let ((*read-default-float-format* 'single-float))
(mapcar #'(lambda(point)
(format nil "~a ~a ~a"
(coerce (get-x point) 'single-float)
(coerce (get-y point) 'single-float)
(coerce (get-z point) 'single-float)))
3d-points))))))))))))
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