Commit df666945 by Dave Cooper

### added more type checking

parent 06fde9eb
 (in-package :geom-base) ;;; Define a data-type for an equivalent to the ICAD 3d-vector and 3d-point... (defun 3d-point? (point) "A predicate function to check if a point is 3-dimensional." (3d-vector-p point) "Boolean. A predicate function to check if a point is 3-dimensional." (3d-point-p point) ) (defun 3d-vector? (vector) "A predicate function to check if a vector is 3-dimensional." "Boolean. A predicate function to check if a vector is 3-dimensional." (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" '(satisfies 3d-vector-p) '(satisfies 3d-point-p) ) (deftype 3d-vector () ... ... @@ -24,7 +23,8 @@ ) (defun 3d-point-p (point) " "Boolean. 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. ... ... @@ -44,11 +44,13 @@ (3d-point-p (make-point 1 2 3 4)) --> nil " (and (eq (array-total-size point) 3) (and (arrayp point) (eq (array-total-size point) 3) (every #'(lambda(entry) (typep entry 'double-float)) point))) (defun 3d-vector-p (vector) " "Boolean. 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. ... ... @@ -68,5 +70,6 @@ (3d-vector-p (make-vector 1 2 3 4)) --> nil " (and (eq (array-total-size vector) 3) (and (arrayp vector) (eq (array-total-size vector) 3) (every #'(lambda(entry) (typep entry 'double-float)) vector)))
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