10 3D-Liniengraphik: "line3d.ss"
Note: This is documentation for the "line3d.rkt" teachpack that goes with the German textbook Die Macht der Abstraktion.
Dieses teachpack definiert Prozeduren für lineare Algebra und 3D-Rendering:
10.1 Szenen erzeugen
value
: (vec3 vec3 number natural natural -> matrix4x4)
Zum Beispiel:
; scene-data (simple box example) (define box (create-box 1.0 1.0 1.0 "brown")) ; screen (define screenWidth 320) (define screenHeight 240) ; camera (define pos (make-vec3 5 5 3)) (define lookat (make-vec3 0 0 0)) (define camera (create-camera-matrix pos lookat 70.0 screenWidth screenHeight)) ; render image (render-scene screenWidth screenHeight box camera)
10.2 3D-Vektoren
value
dotproduct-vec3 : (vec3 vec3 -> number)
value
normQuad-vec3 : (vec3 -> number)
value
normalize-vec3 : (vec3 -> vec3)
value
crossproduct-vec3 : (vec3 vec3-> vec3)
10.3 4D-Vektoren
value
dotproduct-vec4 : (vec3 vec4 -> number)
value
normQuad-vec4 : (vec4 -> number)
value
normalize-vec4 : (vec4 -> vec4)
value
expand-vec3 : (vec3 number -> vec4)
10.4 4x4 Matrizen
value
make-matrix4x4 : (vec4 vec4 vec4 vec4 -> matrix4x4)
value
create-matrix4x4 : (vec3 vec3 vec3 vec3 -> matrix4x4)
value
transpose-matrix4x4 : (matrix4x4 -> matrix4x)
value
multiply-matrix-vec4 : (matrix vec4 -> vec4)
value
transform-vec3 : (matrix4x4 vec3 -> vec3)
value
multiply-matrix : (matrix4x4 matrix4x4 -> matrix4x4)
value
create-translation-matrix : (vec3 -> matrix4x4)
value
create-rotation-x-matrix : (number -> matrix4x4)
value
create-rotation-y-matrix : (number -> matrix4x4)
value
create-rotation-z-matrix : (number -> matrix4x4)
value
create-lookat-matrix : (vec3 vec3 vec3 -> matrix4x4)
value
create-projection-matrix : (number -> matrix4x4)
value
create-viewport-matrix : (natural natural -> matrix4x4)
10.5 3d-Linien
value
make-line3d : (vec3 vec3 color -> line3d)
value
line3d-color : (line3d -> color)
value
create-box : (number number number color -> (list-of line3d))
value
: ((list-of line3d) matrix4x4 -> (list-of line3d))