Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
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
Board
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
4fdfb508
Commit
4fdfb508
authored
Mar 11, 2015
by
Dave Cooper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merged contributed fix for Issue #156
parent
d38eb2c4
Changes
2
Hide whitespace changes
Inline
Sidebyside
Showing
2 changed files
with
85 additions
and
8 deletions
+85
8
utilities.lisp
geombase/prereqs/source/utilities.lisp
+47
8
anglebetweenvectors.lisp
regression/geombase/source/anglebetweenvectors.lisp
+38
0
No files found.
geombase/prereqs/source/utilities.lisp
View file @
4fdfb508
...
...
@@ 426,6 +426,43 @@ if given, must be orthogonal to the first two.
outer
))
listoflists
)))
(
defparameter
*printdeprecatedwarnings?*
nil
)
(
defun
anglebetweenvectorsd
(
vector1
vector2
&optional
referencevector
&rest
args
)
"Number. This function is identical to anglebetweenvectors, but returns the angle in degrees.
Refer to anglebetweenvectors for more information.
Technical note: the <b>more</b> argument has been introduced to support both
anglebetweenvectors call conventions and the legacy signature:
(vector1 vector2 &optional referencevector negative?)
Optionally, a deprecation warning is printed when code invokes this legacy pattern.."
;; resolve &rest arguments.
(
let
((
arglist
(
let
((
length
(
length
args
)))
(
cond
((
=
length
1
)
;; legacy signature:
;; (vector1 vector2 &optional referencevector negative?)
(
when
*printdeprecatedwarnings?*
(
warn
"negative? argument for anglebetweenvectorsd is deprecated. Use :ve instead."
))
(
list
vector1
vector2
referencevector
:ve
(
first
args
)))
((
evenp
length
)
;; anglebetweenvectors signature:
;; (vector1 vector2 &optional referencevector &key (epsilon *zeroepsilon*) ve)
(
nconc
(
list
vector1
vector2
referencevector
)
args
))
(
t
;; not allowed.
(
error
(
format
nil
"anglebetweenvectorsd received invalid arguments: ~a"
(
nconc
(
list
vector1
vector2
referencevector
)
args
))))))))
(
radianstodegrees
(
apply
#'
anglebetweenvectors
arglist
))
))
#+
nil
(
defun
anglebetweenvectorsd
(
vector1
vector2
&optional
referencevector
negative?
)
"Number. Returns the angle in degrees between <tt>vector1</tt> and <tt>vector2</tt>.
If no <tt>referencevector</tt> is given, the smallest possible angle is returned.
...
...
@@ 447,18 +484,20 @@ if given, must be orthogonal to the first two.
(
radianstodegrees
(
anglebetweenvectors
vector1
vector2
))))
(
defun
anglebetweenvectors
(
vector1
vector2
&optional
referencevector
&key
(
epsilon
*zeroepsilon*
)
ve
)
"Number. Returns the angle in radians between <b>vector1</b> and <b>vector2</b>.
If no <b>referencevector</b> given, the smallest possible angle is returned.
If a <b>referencevector</b> is given, computes according to the righthand rule.
If <b>ve</b> is given, returns a negative number for angle if it really is
negative according to the righthand rule.
(
defun
anglebetweenvectors
(
vector1
vector2
&optional
referencevector
&key
(
epsilon
*zeroepsilon*
)
ve
negative?
)
"Number. Returns the angle in radians between <b>vector1</b> and
<b>vector2</b>. If no <b>referencevector</b> given, the smallest
possible angle is returned. If a <b>referencevector</b> is given,
computes according to the righthand rule. If <b>:ve t</b> or
<b>:negative? t</b> is given, returns a negative number for angle
if it really is negative according to the righthand rule.
:arguments (vector1 \"3D Vector\"
vector2 \"3D Vector\")
:&optional ((referencevector nil) \"3D Vector\")
:&key ((epsilon *zeroepsilon*) \"Number. Determines how small of an angle is considered to be zero.\"
(ve nil) \"Boolean\")"
(ve nil) \"Boolean\"
(negative? nil) \"Boolean (synonym to ve)\")"
(
let
((
vector1
(
unitizevector
vector1
))
(
vector2
(
unitizevector
vector2
)))
...
...
@@ 471,7 +510,7 @@ if given, must be orthogonal to the first two.
(
minusp
(
dotvectors
referencevector
(
crossvectors
vector1
vector2
))))
(

(
twice
pi
)
smallestangle
)
smallestangle
)))
(
if
(
and
ve
(
>
try
pi
))
(

try
(
twice
pi
))
try
))))))
(
if
(
and
(
or
ve
negative?
)
(
>
try
pi
))
(

try
(
twice
pi
))
try
))))))
(
defun
unitizevector
(
vector
)
...
...
regression/geombase/source/anglebetweenvectors.lisp
0 → 100644
View file @
4fdfb508
(
inpackage
:gdllifttests
)
(
defineobject
anglebetweenvectorstest
()
:inputslots
((
vector1
(
makevector
1
0
0
))
(
vector2
(
makevector
0
1
0
))
(
vector3
(
makevector
0
0
1
)))
:computedslots
((
vector3r
(
reversevector
(
the
vector3
)))
(
regressiontestdata
(
list
(
anglebetweenvectors
(
the
vector1
)
(
the
vector2
))
(
anglebetweenvectorsd
(
the
vector1
)
(
the
vector2
))
(
anglebetweenvectors
(
the
vector1
)
(
the
vector2
)
(
the
vector3
)
:negative?
t
)
(
anglebetweenvectorsd
(
the
vector1
)
(
the
vector2
)
(
the
vector3
)
:negative?
t
)
(
anglebetweenvectorsd
(
the
vector1
)
(
the
vector2
)
(
the
vector3
)
t
)
(
anglebetweenvectorsd
(
the
vector1
)
(
the
vector2
)
(
the
vector3
)
:negative?
t
:epsilon
0.1
)
(
anglebetweenvectors
(
the
vector1
)
(
the
vector2
)
(
the
vector3r
)
:negative?
t
)
(
anglebetweenvectorsd
(
the
vector1
)
(
the
vector2
)
(
the
vector3r
)
:negative?
t
)
(
anglebetweenvectorsd
(
the
vector1
)
(
the
vector2
)
(
the
vector3r
)
t
)
(
anglebetweenvectorsd
(
the
vector1
)
(
the
vector2
)
(
the
vector3r
)
:negative?
t
:epsilon
0.1
)
(
anglebetweenvectors
(
the
vector1
)
(
the
vector2
)
(
the
vector3r
)
)
(
anglebetweenvectorsd
(
the
vector1
)
(
the
vector2
)
(
the
vector3r
))
(
anglebetweenvectorsd
(
the
vector1
)
(
the
vector2
)
(
the
vector3r
))
(
anglebetweenvectorsd
(
the
vector1
)
(
the
vector2
)
(
the
vector3r
)
:epsilon
0.1
)
))))
(
registertestdefinition
'anglebetweenvectorstest
)
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