Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gendl
gendl
Commits
df666945
Commit
df666945
authored
Apr 04, 2016
by
Dave Cooper
Browse files
added more type checking
parent
06fde9eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
geom-base/prereqs/source/3d-point-vector-data-types.lisp
View file @
df666945
(
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
)))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment