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

trying to fix x3d display of left-handed coord systems, muffling compiler...

trying to fix x3d display of left-handed coord systems, muffling compiler warnings, added some examples.
parent 08130c73
("NACA"
"0012"
1.00000000 0.00000000
0.99726095 0.00038712
0.98907380 0.00153653
0.97552826 0.00341331
0.95677273 0.00596209
0.93301270 0.00911073
0.90450850 0.01277464
0.87157241 0.01686084
0.83456530 0.02127128
0.79389263 0.02590486
0.75000000 0.03065806
0.70336832 0.03542434
0.65450850 0.04009273
0.60395585 0.04454642
0.55226423 0.04866201
0.50000000 0.05231025
0.44773577 0.05535862
0.39604415 0.05767604
0.34549150 0.05913940
0.29663168 0.05964120
0.25000000 0.05909742
0.20610737 0.05745444
0.16543470 0.05469379
0.12842759 0.05083398
0.09549150 0.04592861
0.06698730 0.04006079
0.04322727 0.03333431
0.02447174 0.02586248
0.01092620 0.01775595
0.00273905 0.00911102
0.00000000 0.00000000
0.00273905 -0.00911102
0.01092620 -0.01775595
0.02447174 -0.02586248
0.04322727 -0.03333431
0.06698730 -0.04006079
0.09549150 -0.04592861
0.12842759 -0.05083398
0.16543470 -0.05469379
0.20610737 -0.05745443
0.25000000 -0.05909742
0.29663168 -0.05964120
0.34549150 -0.05913940
0.39604415 -0.05767604
0.44773577 -0.05535862
0.50000000 -0.05231025
0.55226423 -0.04866201
0.60395585 -0.04454642
0.65450850 -0.04009273
0.70336832 -0.03542434
0.75000000 -0.03065806
0.79389263 -0.02590486
0.83456530 -0.02127128
0.87157241 -0.01686084
0.90450850 -0.01277464
0.93301270 -0.00911073
0.95677273 -0.00596209
0.97552826 -0.00341331
0.98907380 -0.00153653
0.99726095 -0.00038712
1.00000000 0.00000000)
(:wing-span
30
:wing-c-root 6
:wing-c-tip 3
:wing-thickness 1
:wing-dihedral 10
:Tmax 800
:rho 0.73
:C-of-F 0.005
:fuselage-diameter 5
:fuselage-length 42
:tail-span
15
:tail-c-root 5
:tail-c-tip 2
:tail-thickness 0.8
:tail-dihedral 8
:rudder-span
10
:rudder-c-root 5
:rudder-c-tip 2
:rudder-thickness 0.8
)
\ No newline at end of file
......@@ -20,11 +20,11 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ATTENTION!!!
ATTENTION!!! DO NOT LOOK AT THIS SOURCE UNTIL YOU TRY THE EXERCISES YOURSELF!!!
ATTENTION!!!
;;
;; ATTENTION!!!
;; ATTENTION!!! DO NOT LOOK AT THIS SOURCE UNTIL YOU TRY THE EXERCISES YOURSELF!!!
;; ATTENTION!!!
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
......
;;
;; Copyright 2012 Genworks International and the Delft University of
;; Technology
;;
;; This source file contains free software: you can redistribute it
;; and/or modify it under the terms of the GNU Affero General Public
;; License as published by the Free Software Foundation, either
;; version 3 of the License, or (at your option) any later version.
;;
;; This source file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; Affero General Public License for more details.
;;
;; You should have received a copy of the GNU Affero General Public
;; License along with this source file. If not, see
;; <http://www.gnu.org/licenses/>.
;;
(in-package :gdl-user)
(defparameter *data-folder*
(make-pathname :name nil
:type nil
:defaults (merge-pathnames "../../data/"
#+allegro excl:*source-pathname*
#+lispworks dspec:*source-pathname*
;; in future: (glisp:source-pathname)
)))
(define-object primi-plane (base-object)
:input-slots
((data-folder *data-folder*)
(aircraft-data-file (merge-pathnames "aircraft-1.dat" (the data-folder)))
(points-data-file (merge-pathnames "NACA_0012.dat" (the data-folder))))
:objects
((data :type 'aircraft-data
:hidden? t
:parameters (with-open-file (in (the aircraft-data-file)) (read in))
:points-data (with-open-file (in (the points-data-file)) (read in)))
(canonical-profile :type 'profile-curve
:hidden? t
:points-data (the data points-data))
(wing-assy :type 'box-wings
:c-root (the data wing-c-root)
:c-tip (the data wing-c-tip)
:span (the data wing-span)
:root-center (translate (the center)
:down (- (the fuselage radius) (half (the-child thickness)))
:front (* 1/6 (the fuselage length)))
:thickness (the data wing-thickness)
:dihedral (the data wing-dihedral)
:canonical-profile (the canonical-profile)
:display-controls (list :color :green)
)
(tail-assy :type 'box-tail
:c-root (the data tail-c-root)
: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)))
:rear (- (half (the fuselage length))
(half (the-child c-root))))
:rudder-root-center (translate (the-child root-center) :up
(- (twice (the fuselage radius))
(half (the-child thickness))))
:thickness (the data tail-thickness)
:dihedral (the data tail-dihedral)
:rudder-span (the data rudder-span)
:rudder-thickness (the data rudder-thickness)
:rudder-c-root (the data rudder-c-root)
:rudder-c-tip (the data rudder-c-tip)
:display-controls (list :color :blue)
)
(fuselage :type 'cylinder-fuselage
:d (the data fuselage-diameter)
:l (the data fuselage-length)
:display-controls (list :color :red)
)))
(define-object aircraft-data ()
:input-slots (wing-span wing-thickness wing-dihedral
wing-c-root wing-c-tip Tmax rho C-of-F
fuselage-diameter fuselage-length
tail-c-root tail-c-tip tail-span
tail-thickness tail-dihedral
points-data
))
(define-object profile-curve (fitted-curve)
:input-slots (points-data)
:computed-slots ((data-name (string-append (first (the points-data))
(second (the points-data))))
(point-coordinates (rest (rest (the points-data))))
(x-coords (plist-keys (the point-coordinates)))
(y-coords (plist-values (the point-coordinates)))
(max-x (most 'get-x (the points)))
(min-x (least 'get-x (the points)))
(max-y (most 'get-y (the points)))
(min-y (least 'get-y (the points)))
(chord (- (get-x (the max-x))
(get-x (the min-x))))
(max-thickness (- (get-y (the max-y))
(get-y (the min-y))))
(points (mapcar #'(lambda(x y) (make-point x y 0))
(the x-coords)
(the y-coords)))))
(define-object cylinder-fuselage (cylinder)
:input-slots (d l)
:computed-slots ((radius (half (the d)))
(length (the l))))
(define-object box-wings (base-object)
:input-slots (root-center span c-root c-tip thickness dihedral canonical-profile)
:objects
((wings :type 'box-wing
:sequence (:size 2)
:root-point (the root-center)
:side (ecase (the-child index) (0 :right) (1 :left))
:span (the span)
:c-root (the c-root)
:c-tip (the c-tip)
:thickness (the thickness)
:canonical-profile (the canonical-profile)
;;
;; Left wing will get a left-handed coordinate system and be a mirror of the right.
;;
:orientation (let* ((hinge (the (face-normal-vector (ecase (the-child side)
(:right :front)
(:left :rear)))))
(right (rotate-vector-d (the (face-normal-vector (the-child side)))
(the dihedral)
hinge)))
(alignment :right right
:top (cross-vectors hinge right)
:front (the (face-normal-vector :front)))))))
(define-object box-tail (box-wings)
:input-slots (rudder-root-center rudder-span rudder-thickness
rudder-c-root rudder-c-tip)
:objects ((rudder :type 'box-wing
:root-point (the rudder-root-center)
:span (the rudder-span)
:c-root (the rudder-c-root)
:c-tip (the rudder-c-tip)
:thickness (the rudder-thickness)
:orientation (alignment :right (the (face-normal-vector :top))
:top (the (face-normal-vector :left))))))
(define-object box-wing (box)
:input-slots (root-point side span c-root c-tip thickness canonical-profile)
:computed-slots ((width (the span))
(length (the c-root))
(height (the thickness))
(center (translate-along-vector (the root-point)
(the (face-normal-vector :right))
(half (the width))
)))
:objects ((box :type 'box
:hidden? t
:display-controls (list :color :yellow :transparency 0.7))
(root-profile :type 'boxed-curve
:curve-in (the canonical-profile)
:orientation (alignment :top (the (face-normal-vector :right))
:rear (the (face-normal-vector :top))
:right (the (face-normal-vector :rear)))
: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)
(tip-profile :type 'boxed-curve
:curve-in (the canonical-profile)
:orientation (alignment :top (the (face-normal-vector :right))
:rear (the (face-normal-vector :top))
:right (the (face-normal-vector :rear)))
:scale-y (/ (the thickness) (the canonical-profile max-thickness))
:scale-x (/ (the c-tip) (the canonical-profile chord))
:center (translate (the (edge-center :right :front))
:rear (- (the length) (the c-tip)))
:hidden? t)
(loft :type 'lofted-surface
:curves (list (the root-profile) (the tip-profile)))))
(in-package :gdl-user)
(define-object brick-wall (base-object)
:input-slots ((width 250)
(height 100)
(length (the brick-length))
(spacing (* (the brick-height) 0.07)))
:computed-slots
((bricks-in-row (floor (/ (the width) (the brick-width))))
(number-of-rows (floor (/ (the height) (the brick-height))))
(brick-width (the sample-brick width))
(brick-height (the sample-brick height))
(brick-length (the sample-brick length))
(corner (translate (the center)
:down (half (the height))
:left (half (the width))))
(extra-even-space (/ (the spacing) (1- (the bricks-in-row)))))
:objects
((sample-brick :type 'brick :hidden? t)
(rows :type 'brick-row
:sequence (:size (the number-of-rows))
:number-of-bricks (the bricks-in-row)
:pass-down (brick-width brick-height corner spacing extra-even-space)
:height (the brick-height)
:width (the width)
:center (translate (if (the-child first?) (the corner) (the-child previous center))
:up (if (the-child first?) (half (the-child height))
(+ (the-child height) (the spacing)))))))
(define-object brick-row (base-object)
:input-slots (number-of-bricks brick-width brick-height corner spacing extra-even-space)
:computed-slots ((odd-row? (and (the index) (oddp (the index)))))
:objects
((bricks :type 'brick
:display-controls (list :color (if (the odd-row?) :red :blue))
:sequence (:size (if (the odd-row?) (1+ (the number-of-bricks)) (the number-of-bricks)))
:center (translate (if (the-child first?) (the center) (the-child previous center))
:right (if (the-child first?) (half (the-child width))
(+ (half (the-child previous width)) (half (the-child width))
(if (the odd-row?) (the spacing)
(+ (the spacing) (the extra-even-space))))))
:width (if (and (the odd-row?) (or (the-child first?) (the-child last?)))
(half (the brick-width))
(the brick-width)))))
(define-object brick (box)
:input-slots
((length 10)
(width 20)
(height 15)
(display-controls (list :color :blue))))
(define-object brick-wall-display (gwl:base-ajax-graphics-sheet)
:computed-slots
((use-x3dom? t)
(use-jquery? t)
(main-sheet-body
(gwl:with-cl-who-string (:indent t)
(:p (:h1 "Sample Display of a Brick Wall"))
(:p ((:|X3D| :id "brick_sample"
:|width| 500 :|height| 500)
(:Scene
(with-format (x3d *stream*)
(write-the wall-drawing cad-output))))))))
:objects
((wall-drawing :type 'gwl:web-drawing
:object-roots (list (the wall)))
(wall :type 'brick-wall)))
(gwl:publish-gwl-app "/brick-wall-display" 'wall-display)
\ No newline at end of file
(asdf:defsystem #:gdl-training :description
"Auto-generated asdf defsys from Genworks GDL cl-lite."
:author
"Genworks and Dave Cooper unless otherwise indicated"
:license "AGPL unless otherwise indicated" :serial t
:version "2012053000" :depends-on (:gdl-smlib)
:components
((:file "slide-show/source/package")
(:file "slide-show/source/assembly")
(:file "slide-show/source/publish")
(:file "g101/source/package")
(:file "g101/source/publish")
(:file "g101/examples/source/file-io")
(:file "g101/examples/source/solutions")
(:file "g101/slides/source/assembly")
(:file "g101/slides/source/conclusion")
(:file "g101/slides/source/control")
(:file "g101/slides/source/data-structures")
(:file "g101/slides/source/functions")
(:file "g101/slides/source/input-output")
(:file "g101/slides/source/introduction")
(:file "g101/slides/source/lists")
(:file "g101/slides/source/macros")
(:file "g101/slides/source/numbers")
(:file "g101/slides/source/symbols")
(:file "g101/slides/source/welcome")
(:file "g102/source/package")
(:file "g102/source/publish")
(:file "g102/examples/ackermann/source/package")
(:file
"g102/examples/ackermann/source/ackermann-assembly")
(:file
"g102/examples/ackermann/source/simple-linkage")
(:file "g102/examples/ackermann/source/tie-rod-arm")
(:file "g102/examples/city/source/package")
(:file "g102/examples/city/source/rules")
(:file "g102/examples/city/source/assembly")
(:file "g102/examples/city/source/building")
(:file "g102/examples/city/source/grid-section")
(:file "g102/examples/solids/source/primitives")
(:file "g102/examples/solids/source/web-page")
(:file "g102/examples/source/fuselage-example")
(:file "g102/examples/source/g102-exercises")
(:file "g102/examples/source/hairy")
(:file "g102/examples/source/section-2-examples")
(:file "g102/examples/source/tower-example")
(:file "g102/examples/table/source/t-support")
(:file "g102/examples/table/source/table")
(:file "g102/slides/source/assembly")
(:file "g102/slides/source/debugging")
(:file "g102/slides/source/fuselage-example")
(:file "g102/slides/source/future")
(:file "g102/slides/source/geometry")
(:file "g102/slides/source/outside-world")
(:file "g102/slides/source/session-01")
(:file "g102/slides/source/session-02")
(:file "g102/slides/source/session-03")
(:file "g102/slides/source/session-04")
(:file "g102/slides/source/session-05")
(:file "g102/slides/source/session-06")
(:file "g102/slides/source/session-07")
(:file "g102/slides/source/tower-example")
(:file "g102/slides/source/user-interface")
(:file "g102/solutions/ackermann/source/package")
(:file
"g102/solutions/ackermann/source/ackermann-assembly")
(:file
"g102/solutions/ackermann/source/simple-linkage")
(:file
"g102/solutions/ackermann/source/tie-rod-arm")
(:file "g102/solutions/city/source/package")
(:file "g102/solutions/city/source/rules")
(:file "g102/solutions/city/source/assembly")
(:file "g102/solutions/city/source/building")
(:file "g102/solutions/city/source/grid-section")
(:file "g102-tud/source/package")
(:file "g102-tud/source/publish")
(:file "g102-tud/examples/source/ch2-examples")
(:file "g102-tud/examples/source/ch2-solutions")
(:file "g102-tud/examples/source/ch3-examples")
(:file "g102-tud/slides/source/ch2")
(:file "g102-tud/slides/source/ch3")
(:file "g105/source/package")
(:file "g105/source/publish")
(:file "g105/examples/source/drilled-block")
(:file "g105/slides/source/assembly")
(:file "g105/slides/source/session-01")
(:file "g105/slides/source/session-02")
(:file "g108/source/package")
(:file "g108/source/publish")
(:file "g108/examples/source/examples")
(:file "g108/slides/source/ajax-sections")
(:file "g108/slides/source/assembly")
(:file "g108/slides/source/basic-sheet")))
\ No newline at end of file
(asdf:defsystem #:gdl-training
:description
"Auto-generated asdf defsys from Genworks GDL cl-lite."
:author
"Genworks and Dave Cooper unless otherwise indicated"
:license
"AGPL unless otherwise indicated"
:serial
t
:version
"2012060300"
:depends-on
(:gdl-smlib)
:components
((:file "slide-show/source/package")
(:file "slide-show/source/assembly")
(:file "slide-show/source/publish")
(:file "g101/source/package")
(:file "g101/source/publish")
(:file "g101/examples/source/file-io")
(:file "g101/examples/source/solutions")
(:file "g101/slides/source/assembly")
(:file "g101/slides/source/conclusion")
(:file "g101/slides/source/control")
(:file "g101/slides/source/data-structures")
(:file "g101/slides/source/functions")
(:file "g101/slides/source/input-output")
(:file "g101/slides/source/introduction")
(:file "g101/slides/source/lists")
(:file "g101/slides/source/macros")
(:file "g101/slides/source/numbers")
(:file "g101/slides/source/symbols")
(:file "g101/slides/source/welcome")
(:file "g102/source/package")
(:file "g102/source/publish")
(:file "g102/examples/ackermann/source/package")
(:file "g102/examples/ackermann/source/ackermann-assembly")
(:file "g102/examples/ackermann/source/simple-linkage")
(:file "g102/examples/ackermann/source/tie-rod-arm")
(:file "g102/examples/city/source/package")
(:file "g102/examples/city/source/rules")
(:file "g102/examples/city/source/assembly")
(:file "g102/examples/city/source/building")
(:file "g102/examples/city/source/grid-section")
(:file "g102/examples/solids/source/primitives")
(:file "g102/examples/solids/source/web-page")
(:file "g102/examples/source/fuselage-example")
(:file "g102/examples/source/g102-exercises")
(:file "g102/examples/source/hairy")
(:file "g102/examples/source/section-2-examples")
(:file "g102/examples/source/tower-example")
(:file "g102/examples/table/source/t-support")
(:file "g102/examples/table/source/table")
(:file "g102/slides/source/assembly")
(:file "g102/slides/source/debugging")
(:file "g102/slides/source/fuselage-example")
(:file "g102/slides/source/future")
(:file "g102/slides/source/geometry")
(:file "g102/slides/source/outside-world")
(:file "g102/slides/source/session-01")
(:file "g102/slides/source/session-02")
(:file "g102/slides/source/session-03")
(:file "g102/slides/source/session-04")
(:file "g102/slides/source/session-05")
(:file "g102/slides/source/session-06")
(:file "g102/slides/source/session-07")
(:file "g102/slides/source/tower-example")
(:file "g102/slides/source/user-interface")
(:file "g102/solutions/ackermann/source/package")
(:file "g102/solutions/ackermann/source/ackermann-assembly")
(:file "g102/solutions/ackermann/source/simple-linkage")
(:file "g102/solutions/ackermann/source/tie-rod-arm")
(:file "g102/solutions/city/source/package")
(:file "g102/solutions/city/source/rules")
(:file "g102/solutions/city/source/assembly")
(:file "g102/solutions/city/source/building")
(:file "g102/solutions/city/source/grid-section")
(:file "g102-tud/source/package")
(:file "g102-tud/source/publish")