Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Thomas Pitiot
CGoGN
Commits
8e0ed488
Commit
8e0ed488
authored
Mar 23, 2012
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bounding box : origin centered scale
parent
3bee55cb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
41 deletions
+31
-41
include/Algo/MC/marchingcube.h
include/Algo/MC/marchingcube.h
+7
-4
include/Geometry/bounding_box.h
include/Geometry/bounding_box.h
+7
-8
include/Geometry/bounding_box.hpp
include/Geometry/bounding_box.hpp
+11
-20
include/Geometry/plane_3d.h
include/Geometry/plane_3d.h
+1
-1
include/Geometry/plane_3d.hpp
include/Geometry/plane_3d.hpp
+5
-8
No files found.
include/Algo/MC/marchingcube.h
View file @
8e0ed488
...
@@ -37,7 +37,9 @@ namespace CGoGN
...
@@ -37,7 +37,9 @@ namespace CGoGN
namespace
Algo
namespace
Algo
{
{
namespace
MC
{
namespace
MC
{
/**
/**
* Marching Cube
* Marching Cube
*
*
...
@@ -257,10 +259,11 @@ public:
...
@@ -257,10 +259,11 @@ public:
void
recalPoints
(
const
Geom
::
Vec3f
&
origin
);
void
recalPoints
(
const
Geom
::
Vec3f
&
origin
);
};
};
}
// namespace MC
}
// namespace Algo
}
// end namespace
}
// namespace CGoGN
}
// end namespace
}
// end namespace
#include "Algo/MC/marchingcube.hpp"
#include "Algo/MC/marchingcube.hpp"
#endif
#endif
include/Geometry/bounding_box.h
View file @
8e0ed488
...
@@ -89,23 +89,22 @@ class BoundingBox
...
@@ -89,23 +89,22 @@ class BoundingBox
// fusion with the given bounding box
// fusion with the given bounding box
void
fusion
(
const
BoundingBox
<
VEC
>&
bb
)
;
void
fusion
(
const
BoundingBox
<
VEC
>&
bb
)
;
//return true if the vector belongs strictly to a bounding box
//
return true if the vector belongs strictly to a bounding box
bool
contains
(
const
VEC
&
p
);
bool
contains
(
const
VEC
&
p
);
//return true if the bounding box belongs strictly to a bounding box
//
return true if the bounding box belongs strictly to a bounding box
bool
contains
(
const
BoundingBox
<
VEC
>
&
bb
);
bool
contains
(
const
BoundingBox
<
VEC
>
&
bb
);
//resize a bounding box
// scale the bounding box
void
scale
(
float
size
);
void
scale
(
typename
VEC
::
DATA_TYPE
size
);
// 0-centered scale of the bounding box
void
centeredScale
(
typename
VEC
::
DATA_TYPE
size
);
/**********************************************/
/**********************************************/
/* STREAM OPERATORS */
/* STREAM OPERATORS */
/**********************************************/
/**********************************************/
// friend std::ostream& operator<<(std::ostream& out, const BoundingBox<VEC>& bb);
//
// friend std::istream& operator>>(std::istream& in, BoundingBox<VEC>& bb);
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
BoundingBox
<
VEC
>&
bb
)
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
BoundingBox
<
VEC
>&
bb
)
{
{
out
<<
bb
.
min
()
<<
" "
<<
bb
.
max
()
;
out
<<
bb
.
min
()
<<
" "
<<
bb
.
max
()
;
...
...
include/Geometry/bounding_box.hpp
View file @
8e0ed488
...
@@ -142,7 +142,7 @@ bool BoundingBox<VEC>::isInitialized() const
...
@@ -142,7 +142,7 @@ bool BoundingBox<VEC>::isInitialized() const
template
<
typename
VEC
>
template
<
typename
VEC
>
void
BoundingBox
<
VEC
>::
reset
()
void
BoundingBox
<
VEC
>::
reset
()
{
{
m_initialized
=
false
;
m_initialized
=
false
;
}
}
template
<
typename
VEC
>
template
<
typename
VEC
>
...
@@ -197,7 +197,6 @@ void BoundingBox<VEC>::fusion(const BoundingBox<VEC>& bb)
...
@@ -197,7 +197,6 @@ void BoundingBox<VEC>::fusion(const BoundingBox<VEC>& bb)
}
}
}
}
template
<
typename
VEC
>
template
<
typename
VEC
>
bool
BoundingBox
<
VEC
>::
contains
(
const
VEC
&
p
)
bool
BoundingBox
<
VEC
>::
contains
(
const
VEC
&
p
)
{
{
...
@@ -221,28 +220,20 @@ bool BoundingBox<VEC>::contains(const BoundingBox<VEC>& bb)
...
@@ -221,28 +220,20 @@ bool BoundingBox<VEC>::contains(const BoundingBox<VEC>& bb)
}
}
template
<
typename
VEC
>
template
<
typename
VEC
>
void
BoundingBox
<
VEC
>::
scale
(
float
size
)
void
BoundingBox
<
VEC
>::
scale
(
typename
VEC
::
DATA_TYPE
size
)
{
{
assert
(
m_initialized
||
!
"Bounding box not initialized"
);
assert
(
m_initialized
||
!
"Bounding box not initialized"
);
m_pMin
*=
size
;
m_pMin
*=
size
;
m_pMax
*=
size
;
m_pMax
*=
size
;
}
}
template
<
typename
VEC
>
void
BoundingBox
<
VEC
>::
centeredScale
(
typename
VEC
::
DATA_TYPE
size
)
//template <typename VEC>
{
//friend std::ostream& BoundingBox<VEC>::operator<<(std::ostream& out, const BoundingBox<VEC>& bb)
VEC
center
=
(
m_pMin
+
m_pMax
)
/
typename
VEC
::
DATA_TYPE
(
2
)
;
//{
m_pMin
=
((
m_pMin
-
center
)
*
size
)
+
center
;
// out << bb.min() << " " << bb.max() ;
m_pMax
=
((
m_pMax
-
center
)
*
size
)
+
center
;
// return out ;
}
//}
//
//template <typename VEC>
//friend std::istream& BoundingBox<VEC>::operator>>(std::istream& in, BoundingBox<VEC>& bb)
//{
// in >> bb.min() >> bb.max() ;
// return in ;
//}
}
// namespace Geom
}
// namespace Geom
...
...
include/Geometry/plane_3d.h
View file @
8e0ed488
...
@@ -109,6 +109,6 @@ class Plane3D
...
@@ -109,6 +109,6 @@ class Plane3D
}
// namespace CGoGN
}
// namespace CGoGN
#include "plane_3d.hpp"
#include "
Geometry/
plane_3d.hpp"
#endif
#endif
include/Geometry/plane_3d.hpp
View file @
8e0ed488
...
@@ -44,8 +44,7 @@ std::string Plane3D<T>::CGoGNnameOfType()
...
@@ -44,8 +44,7 @@ std::string Plane3D<T>::CGoGNnameOfType()
/**********************************************/
/**********************************************/
template
<
typename
T
>
template
<
typename
T
>
Plane3D
<
T
>::
Plane3D
(
int
d
)
:
Plane3D
<
T
>::
Plane3D
(
int
d
)
:
m_normal
(
0
),
m_d
(
d
)
m_normal
(
0
),
m_d
(
d
)
{
}
{
}
template
<
typename
T
>
template
<
typename
T
>
...
@@ -56,15 +55,13 @@ Plane3D<T>::Plane3D(const Plane3D<T>& p)
...
@@ -56,15 +55,13 @@ Plane3D<T>::Plane3D(const Plane3D<T>& p)
}
}
template
<
typename
T
>
template
<
typename
T
>
Plane3D
<
T
>::
Plane3D
(
const
Vector
<
3
,
T
>&
n
,
T
d
)
:
Plane3D
<
T
>::
Plane3D
(
const
Vector
<
3
,
T
>&
n
,
T
d
)
:
m_normal
(
n
),
m_d
(
d
)
m_normal
(
n
),
m_d
(
d
)
{
{
m_normal
.
normalize
();
m_normal
.
normalize
();
}
}
template
<
typename
T
>
template
<
typename
T
>
Plane3D
<
T
>::
Plane3D
(
const
Vector
<
3
,
T
>&
n
,
const
Vector
<
3
,
T
>&
p
)
:
Plane3D
<
T
>::
Plane3D
(
const
Vector
<
3
,
T
>&
n
,
const
Vector
<
3
,
T
>&
p
)
:
m_normal
(
n
),
m_d
(
-
(
p
*
n
))
m_normal
(
n
),
m_d
(
-
(
p
*
n
))
{
{
m_normal
.
normalize
();
m_normal
.
normalize
();
}
}
...
@@ -118,7 +115,7 @@ T Plane3D<T>::distance(const Vector<3,T>& p) const
...
@@ -118,7 +115,7 @@ T Plane3D<T>::distance(const Vector<3,T>& p) const
template
<
typename
T
>
template
<
typename
T
>
void
Plane3D
<
T
>::
project
(
Vector
<
3
,
T
>&
p
)
const
void
Plane3D
<
T
>::
project
(
Vector
<
3
,
T
>&
p
)
const
{
{
#define PRECISION 1e-
5
#define PRECISION 1e-
10
T
d
=
-
distance
(
p
)
;
T
d
=
-
distance
(
p
)
;
if
(
abs
(
d
)
>
PRECISION
)
if
(
abs
(
d
)
>
PRECISION
)
{
{
...
@@ -131,7 +128,7 @@ void Plane3D<T>::project(Vector<3,T>& p) const
...
@@ -131,7 +128,7 @@ void Plane3D<T>::project(Vector<3,T>& p) const
template
<
typename
T
>
template
<
typename
T
>
Orientation3D
Plane3D
<
T
>::
orient
(
const
Vector
<
3
,
T
>&
p
)
const
Orientation3D
Plane3D
<
T
>::
orient
(
const
Vector
<
3
,
T
>&
p
)
const
{
{
#define PRECISION 1e-
5
#define PRECISION 1e-
10
T
dist
=
distance
(
p
)
;
T
dist
=
distance
(
p
)
;
if
(
dist
<
-
PRECISION
)
if
(
dist
<
-
PRECISION
)
return
UNDER
;
return
UNDER
;
...
...
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