Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs-feliks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Feliks Kiszkurno
ogs-feliks
Commits
8a0a451a
Commit
8a0a451a
authored
10 years ago
by
Karsten Rink
Browse files
Options
Downloads
Patches
Plain Diff
renamed distance method, changed initialisation list, fixed issue with volume calculation
parent
fb3993cf
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GeoLib/AnalyticalGeometry.cpp
+1
-1
1 addition, 1 deletion
GeoLib/AnalyticalGeometry.cpp
GeoLib/BoundingSphere.cpp
+13
-7
13 additions, 7 deletions
GeoLib/BoundingSphere.cpp
GeoLib/BoundingSphere.h
+5
-3
5 additions, 3 deletions
GeoLib/BoundingSphere.h
with
19 additions
and
11 deletions
GeoLib/AnalyticalGeometry.cpp
+
1
−
1
View file @
8a0a451a
...
...
@@ -255,7 +255,7 @@ double calcTetrahedronVolume(const double* x1, const double* x2, const double* x
const
MathLib
::
Vector3
ab
(
x1
,
x2
);
const
MathLib
::
Vector3
ac
(
x1
,
x3
);
const
MathLib
::
Vector3
ad
(
x1
,
x4
);
return
GeoLib
::
scalarTriple
(
ab
,
ac
,
ad
)
/
6.0
;
return
std
::
abs
(
GeoLib
::
scalarTriple
(
ac
,
ad
,
ab
)
)
/
6.0
;
}
// NewellPlane from book Real-Time Collision detection p. 494
...
...
This diff is collapsed.
Click to expand it.
GeoLib/BoundingSphere.cpp
+
13
−
7
View file @
8a0a451a
...
...
@@ -22,27 +22,33 @@
namespace
GeoLib
{
BoundingSphere
::
BoundingSphere
()
:
_center
(
std
::
numeric_limits
<
double
>::
max
(),
std
::
numeric_limits
<
double
>::
max
(),
std
::
numeric_limits
<
double
>::
max
())
,
_radius
(
-
1
)
:
_radius
(
-
1
),
_center
(
std
::
numeric_limits
<
double
>::
max
(),
std
::
numeric_limits
<
double
>::
max
(),
std
::
numeric_limits
<
double
>::
max
())
{
}
BoundingSphere
::
BoundingSphere
(
BoundingSphere
const
&
sphere
)
:
_
center
(
sphere
.
get
Center
()),
_radius
(
sphere
.
get
Radius
())
:
_
radius
(
sphere
.
get
Radius
()),
_center
(
sphere
.
get
Center
())
{
}
BoundingSphere
::
BoundingSphere
(
BoundingSphere
const
&&
sphere
)
:
_radius
(
sphere
.
getRadius
()),
_center
(
sphere
.
getCenter
())
{
}
BoundingSphere
::
BoundingSphere
(
GeoLib
::
Point
const
&
p
)
:
_center
(
p
),
_radius
(
std
::
numeric_limits
<
double
>::
epsilon
())
:
_radius
(
std
::
numeric_limits
<
double
>::
epsilon
())
,
_center
(
p
)
{
}
BoundingSphere
::
BoundingSphere
(
GeoLib
::
Point
const
&
p
,
double
radius
)
:
_center
(
p
),
_radius
(
radius
)
:
_radius
(
radius
)
,
_center
(
p
)
{
}
BoundingSphere
::
BoundingSphere
(
GeoLib
::
Point
const
&
p
,
GeoLib
::
Point
const
&
q
)
:
_center
(
p
),
_radius
(
std
::
numeric_limits
<
double
>::
epsilon
())
:
_radius
(
std
::
numeric_limits
<
double
>::
epsilon
())
,
_center
(
p
)
{
MathLib
::
Vector3
const
a
(
p
,
q
);
...
...
@@ -164,7 +170,7 @@ BoundingSphere BoundingSphere::recurseCalculation(std::vector<GeoLib::Point*> sp
for
(
std
::
size_t
i
=
0
;
i
<
length
;
++
i
)
{
// current point is located outside of sphere
if
(
sphere
.
sqrP
ointDist
(
*
sphere_points
[
start_idx
+
i
])
>
0
)
if
(
sphere
.
p
ointDist
anceSquared
(
*
sphere_points
[
start_idx
+
i
])
>
0
)
{
if
(
i
>
start_idx
)
{
...
...
@@ -178,7 +184,7 @@ BoundingSphere BoundingSphere::recurseCalculation(std::vector<GeoLib::Point*> sp
return
sphere
;
}
double
BoundingSphere
::
sqrP
ointDist
(
GeoLib
::
Point
const
&
pnt
)
const
double
BoundingSphere
::
p
ointDist
anceSquared
(
GeoLib
::
Point
const
&
pnt
)
const
{
return
MathLib
::
sqrDist
(
_center
.
getCoords
(),
pnt
.
getCoords
())
-
(
_radius
*
_radius
);
}
...
...
This diff is collapsed.
Click to expand it.
GeoLib/BoundingSphere.h
+
5
−
3
View file @
8a0a451a
...
...
@@ -31,6 +31,8 @@ public:
BoundingSphere
();
/// Copy constructor
BoundingSphere
(
BoundingSphere
const
&
sphere
);
/// Move constructor
BoundingSphere
(
BoundingSphere
const
&&
sphere
);
/// Point-Sphere
BoundingSphere
(
GeoLib
::
Point
const
&
p
);
/// Constructor using center and radius
...
...
@@ -51,10 +53,10 @@ public:
/// Returns the radius of the sphere
double
getRadius
()
const
{
return
_radius
;
}
/// Returns the squared distance of a point from the sphere (for points within the sphere distance is negative)
double
sqrP
ointDist
(
GeoLib
::
Point
const
&
pnt
)
const
;
/// Returns the squared
euclidean
distance of a point from the sphere (for points within the sphere distance is negative)
double
p
ointDist
anceSquared
(
GeoLib
::
Point
const
&
pnt
)
const
;
/// Creates n_points random points located on the surface of the sphere (useful for visualisation)
/// Creates n_points random points located on the surface of the
bounding
sphere (useful for visualisation)
std
::
vector
<
GeoLib
::
Point
*>*
getRandomSpherePoints
(
std
::
size_t
n_points
)
const
;
private
:
...
...
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