Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
ed744a09
Commit
ed744a09
authored
Jun 16, 2011
by
Kenneth Vanhoey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvement of localFrame (added some functionalities)
parent
06e4aca5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
14 deletions
+58
-14
include/Utils/localFrame.h
include/Utils/localFrame.h
+27
-5
include/Utils/localFrame.hpp
include/Utils/localFrame.hpp
+31
-9
No files found.
include/Utils/localFrame.h
View file @
ed744a09
...
...
@@ -45,7 +45,7 @@ template <typename PFP>
class
LocalFrame
{
typedef
typename
PFP
::
REAL
REAL
;
typedef
typename
PFP
::
VEC2
VEC2
;
typedef
typename
Geom
::
Vector
<
2
,
REAL
>
VEC2
;
typedef
typename
PFP
::
VEC3
VEC3
;
private:
// fields
...
...
@@ -74,29 +74,51 @@ public: // methods
*/
VEC3
getCompressed
()
;
/**
* Tests if the frames are identical
* @param lf the frame to compare to the current frame
* @param epsilon the authorized deviation
* @return true if frames are identical (or deviate less than epsilon)
*/
bool
equals
(
const
LocalFrame
<
PFP
>&
lf
,
REAL
epsilon
=
1e-5
)
const
;
/**
* Equality of frames
* Identical to calling equals with default epsilon
* @return true if frames are identical
*/
bool
operator
==
(
const
LocalFrame
<
PFP
>&
lf
)
const
;
/**
* Inequality of frames
* Identical to calling !equals with default epsilon
* @return false if frames are identical
*/
bool
operator
!=
(
const
LocalFrame
<
PFP
>&
lf
)
const
;
/**
* Tests if the frame is direct
* @return true if the frame is direct
*/
bool
isDirect
()
;
bool
isDirect
()
const
;
/**
* Tests if the frame is orthogonal
* @return true if the frame is orthogonal
*/
bool
isOrthogonal
()
;
bool
isOrthogonal
()
const
;
/**
* Tests if the frame is normalized
* @return true if the frame is normalized
*/
bool
isNormalized
()
;
bool
isNormalized
()
const
;
/**
* Tests if the frame is direct, normalized and orthogonal
* @return true if the frame is direct, normalized and orthogonal
*/
bool
isOrthoNormalDirect
()
;
bool
isOrthoNormalDirect
()
const
;
/**
* @return current tangent vector
...
...
include/Utils/localFrame.hpp
View file @
ed744a09
...
...
@@ -84,7 +84,29 @@ typename PFP::VEC3 LocalFrame<PFP>::getCompressed()
}
template
<
typename
PFP
>
bool
LocalFrame
<
PFP
>::
isDirect
()
bool
LocalFrame
<
PFP
>::
equals
(
const
Utils
::
LocalFrame
<
PFP
>&
lf
,
REAL
epsilon
)
const
{
VEC3
dT
=
m_T
-
lf
.
getT
()
;
VEC3
dB
=
m_B
-
lf
.
getB
()
;
VEC3
dN
=
m_N
-
lf
.
getN
()
;
return
dT
.
norm2
()
<
epsilon
&&
dB
.
norm2
()
<
epsilon
&&
dN
.
norm2
()
<
epsilon
;
}
template
<
typename
PFP
>
bool
LocalFrame
<
PFP
>::
operator
==
(
const
LocalFrame
<
PFP
>&
lf
)
const
{
return
this
->
equals
(
lf
)
;
}
template
<
typename
PFP
>
bool
LocalFrame
<
PFP
>::
operator
!=
(
const
LocalFrame
<
PFP
>&
lf
)
const
{
return
!
(
this
->
equals
(
lf
))
;
}
template
<
typename
PFP
>
bool
LocalFrame
<
PFP
>::
isDirect
()
const
{
VEC3
new_B
=
m_N
^
m_T
;
// direct
VEC3
diffs
=
new_B
-
m_B
;
// differences with existing B
...
...
@@ -94,27 +116,27 @@ bool LocalFrame<PFP>::isDirect()
}
template
<
typename
PFP
>
bool
LocalFrame
<
PFP
>::
isOrthogonal
()
bool
LocalFrame
<
PFP
>::
isOrthogonal
()
const
{
return
(
abs
(
m_T
*
m_B
)
<
1e-10
)
&&
(
abs
(
m_N
*
m_B
)
<
1e-10
)
&&
(
abs
(
m_T
*
m_N
)
<
1e-10
)
;
return
(
fabs
(
m_T
*
m_B
)
<
1e-5
)
&&
(
fabs
(
m_N
*
m_B
)
<
1e-5
)
&&
(
fabs
(
m_T
*
m_N
)
<
1e-5
)
;
}
template
<
typename
PFP
>
bool
LocalFrame
<
PFP
>::
isNormalized
()
bool
LocalFrame
<
PFP
>::
isNormalized
()
const
{
return
(
1
-
1e-
10
<
m_N
.
norm2
()
&&
m_N
.
norm2
()
<
1
+
1e-10
)
&&
(
1
-
1e-
10
<
m_T
.
norm2
()
&&
m_T
.
norm2
()
<
1
+
1e-10
)
&&
(
1
-
1e-
10
<
m_B
.
norm2
()
&&
m_B
.
norm2
()
<
1
+
1e-10
)
;
return
(
1
-
1e-
5
<
m_N
.
norm2
()
&&
m_N
.
norm2
()
<
1
+
1e-5
)
&&
(
1
-
1e-
5
<
m_T
.
norm2
()
&&
m_T
.
norm2
()
<
1
+
1e-5
)
&&
(
1
-
1e-
5
<
m_B
.
norm2
()
&&
m_B
.
norm2
()
<
1
+
1e-5
)
;
}
template
<
typename
PFP
>
bool
LocalFrame
<
PFP
>::
isOrthoNormalDirect
()
bool
LocalFrame
<
PFP
>::
isOrthoNormalDirect
()
const
{
return
isOrthogonal
()
&&
isNormalized
()
&&
isDirect
()
;
}
template
<
typename
PFP
>
typename
PFP
::
VEC2
LocalFrame
<
PFP
>::
carthToSpherical
(
const
VEC3
&
carth
)
const
typename
Geom
::
Vector
<
2
,
typename
PFP
::
REAL
>
LocalFrame
<
PFP
>::
carthToSpherical
(
const
VEC3
&
carth
)
const
{
VEC2
res
;
...
...
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