3d-point-vector-data-types.lisp 1.86 KB
 Dave Cooper committed Apr 04, 2016 1 ``````(in-package :geom-base) `````` Dave Cooper committed Mar 02, 2016 2 3 `````` (defun 3d-point? (point) `````` Dave Cooper committed Apr 04, 2016 4 5 `````` "Boolean. A predicate function to check if a point is 3-dimensional." (3d-point-p point) `````` Dave Cooper committed Mar 02, 2016 6 7 8 `````` ) (defun 3d-vector? (vector) `````` Dave Cooper committed Apr 04, 2016 9 `````` "Boolean. A predicate function to check if a vector is 3-dimensional." `````` Dave Cooper committed Mar 02, 2016 10 11 12 13 14 15 `````` (3d-vector-p vector) ) (deftype 3d-point () "Datatype 3d-point is the result of a make-point function using 3 coordinates (e.g., X, Y & Z), not an instance of the define-object point" `````` Dave Cooper committed Apr 04, 2016 16 `````` '(satisfies 3d-point-p) `````` Dave Cooper committed Mar 02, 2016 17 18 19 20 21 22 23 24 25 `````` ) (deftype 3d-vector () "Datatype 3d-vector is the result of a make-vector function using 3 coordinates." '(satisfies 3d-vector-p) ) (defun 3d-point-p (point) `````` Dave Cooper committed Apr 04, 2016 26 27 `````` "Boolean. `````` Dave Cooper committed Mar 02, 2016 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 `````` FUNCTION 3d-point-p - predicate function to check if a make-point is 3D. That is, the point has 3 dimensions, representing a 3-dimensional point. USAGE 3d-point-p point DESCRIPTION A predicate function to check if a point is 3-dimensional. The function may also be accessed by calling the function 3d-point?. EXAMPLES (3d-point-p (make-point 1 2 3)) --> t (3d-point-p (make-point 1 2 3 4)) --> nil " `````` Dave Cooper committed Apr 04, 2016 47 48 `````` (and (arrayp point) (eq (array-total-size point) 3) `````` Dave Cooper committed Mar 02, 2016 49 50 51 `````` (every #'(lambda(entry) (typep entry 'double-float)) point))) (defun 3d-vector-p (vector) `````` Dave Cooper committed Apr 04, 2016 52 53 `````` "Boolean. `````` Dave Cooper committed Mar 02, 2016 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 `````` FUNCTION 3d-vector-p - predicate function to check if a vector is 3D. That is, the vector has 3 dimensions, representing a 3-dimensional vector. USAGE 3d-vector-p vector DESCRIPTION A predicate function to check if a vector is 3-dimensional. The function may also be accessed by calling the function 3d-vector?. EXAMPLES (3d-vector-p (make-vector 1 2 3)) --> t (3d-vector-p (make-vector 1 2 3 4)) --> nil " `````` Dave Cooper committed Apr 04, 2016 73 74 `````` (and (arrayp vector) (eq (array-total-size vector) 3) `````` Dave Cooper committed Mar 02, 2016 75 `` (every #'(lambda(entry) (typep entry 'double-float)) vector)))``