Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
openstructure
Commits
2826b5bc
Commit
2826b5bc
authored
13 years ago
by
Andreas Schenk
Browse files
Options
Downloads
Patches
Plain Diff
fixed bug in SignedAngle for parallel Vec2s / added export for SingedAngle
parent
f9ff5e87
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/geom/pymod/export_vecmat2_op.cc
+2
-0
2 additions, 0 deletions
modules/geom/pymod/export_vecmat2_op.cc
modules/geom/src/vecmat2_op.cc
+8
-4
8 additions, 4 deletions
modules/geom/src/vecmat2_op.cc
with
10 additions
and
4 deletions
modules/geom/pymod/export_vecmat2_op.cc
+
2
−
0
View file @
2826b5bc
...
...
@@ -33,6 +33,7 @@ Real (*Mat2Det)(const Mat2& m) = &Det;
Mat2
(
*
Mat2Invert
)(
const
Mat2
&
m
)
=
&
Invert
;
Mat2
(
*
Mat2Transpose
)(
const
Mat2
&
m
)
=
&
Transpose
;
Real
(
*
Vec2Angle
)(
const
Vec2
&
v1
,
const
Vec2
&
v2
)
=
&
Angle
;
Real
(
*
Vec2SignedAngle
)(
const
Vec2
&
v1
,
const
Vec2
&
v2
)
=
&
SignedAngle
;
Vec2
(
*
Vec2Normalize
)(
const
Vec2
&
v1
)
=
&
Normalize
;
Vec2
(
*
Vec2Rotate
)(
const
Vec2
&
v1
,
Real
ang
)
=
&
Rotate
;
Vec2
(
*
Vec2Min
)(
const
Vec2
&
,
const
Vec2
&
)
=
&
Min
;
...
...
@@ -53,6 +54,7 @@ void export_VecMat2_op()
def
(
"Invert"
,
Mat2Invert
);
def
(
"Transpose"
,
Mat2Transpose
);
def
(
"Angle"
,
Vec2Angle
);
def
(
"SignedAngle"
,
Vec2SignedAngle
);
def
(
"Normalize"
,
Vec2Normalize
);
def
(
"Rotate"
,
Vec2Rotate
);
def
(
"Min"
,
Vec2Min
);
...
...
This diff is collapsed.
Click to expand it.
modules/geom/src/vecmat2_op.cc
+
8
−
4
View file @
2826b5bc
...
...
@@ -55,11 +55,15 @@ Real Angle(const Vec2& v1, const Vec2& v2)
Real
SignedAngle
(
const
Vec2
&
v1
,
const
Vec2
&
v2
)
{
Vec3
vc
;
vc
=
Cross
(
Vec3
(
v1
),
Vec3
(
v2
));
if
(
Length
(
v1
)
==
0.0
||
Length
(
v2
)
==
0.0
||
Length
(
vc
)
==
0.0
)
if
(
Length
(
v1
)
==
0.0
||
Length
(
v2
)
==
0.0
){
return
0.0
;
return
acos
(
Dot
(
v1
,
v2
)
/
Length
(
v1
)
/
Length
(
v2
))
*
vc
.
z
/
std
::
fabs
(
vc
.
z
);
}
Vec3
vc
=
Cross
(
Vec3
(
v1
),
Vec3
(
v2
));
Real
sign
=
1.0
;
if
(
vc
.
z
!=
0.0
){
sign
=
vc
.
z
/
std
::
fabs
(
vc
.
z
);
}
return
acos
(
Dot
(
v1
,
v2
)
/
Length
(
v1
)
/
Length
(
v2
))
*
sign
;
}
Vec2
Rotate
(
const
Vec2
&
v
,
Real
ang
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment