Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gendl
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
45
Issues
45
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
gendl
gendl
Commits
df666945
Commit
df666945
authored
Apr 04, 2016
by
Dave Cooper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added more type checking
parent
06fde9eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
geom-base/prereqs/source/3d-point-vector-data-types.lisp
geom-base/prereqs/source/3d-point-vector-data-types.lisp
+13
-10
No files found.
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