IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
corsika
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue 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
Antonio Augusto Alves Junior
corsika
Commits
853ddcee
Commit
853ddcee
authored
6 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
more functionality for geometry
parent
c7f46af8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Framework/Geometry/QuantityVector.h
+8
-2
8 additions, 2 deletions
Framework/Geometry/QuantityVector.h
Framework/Geometry/Sphere.h
+27
-0
27 additions, 0 deletions
Framework/Geometry/Sphere.h
Framework/Geometry/Vector.h
+22
-0
22 additions, 0 deletions
Framework/Geometry/Vector.h
with
57 additions
and
2 deletions
Framework/Geometry/QuantityVector.h
+
8
−
2
View file @
853ddcee
...
@@ -11,6 +11,7 @@ class QuantityVector
...
@@ -11,6 +11,7 @@ class QuantityVector
{
{
protected:
protected:
using
Quantity
=
phys
::
units
::
quantity
<
dim
,
double
>
;
using
Quantity
=
phys
::
units
::
quantity
<
dim
,
double
>
;
using
QuantitySquared
=
decltype
(
Quantity
(
phys
::
units
::
detail
::
magnitude_tag
,
0
)
*
Quantity
(
phys
::
units
::
detail
::
magnitude_tag
,
0
));
public:
public:
Eigen
::
Vector3d
eVector
;
Eigen
::
Vector3d
eVector
;
...
@@ -25,16 +26,21 @@ public:
...
@@ -25,16 +26,21 @@ public:
{
{
}
}
Quantity
operator
[](
size_t
index
)
const
auto
operator
[](
size_t
index
)
const
{
{
return
Quantity
(
phys
::
units
::
detail
::
magnitude_tag
,
eVector
[
index
]);
return
Quantity
(
phys
::
units
::
detail
::
magnitude_tag
,
eVector
[
index
]);
}
}
Quantity
norm
()
const
auto
norm
()
const
{
{
return
Quantity
(
phys
::
units
::
detail
::
magnitude_tag
,
eVector
.
norm
());
return
Quantity
(
phys
::
units
::
detail
::
magnitude_tag
,
eVector
.
norm
());
}
}
auto
squaredNorm
()
const
{
return
QuantitySquared
(
phys
::
units
::
detail
::
magnitude_tag
,
eVector
.
squaredNorm
());
}
auto
operator
+
(
QuantityVector
<
dim
>
const
&
pQVec
)
const
auto
operator
+
(
QuantityVector
<
dim
>
const
&
pQVec
)
const
{
{
return
QuantityVector
<
dim
>
(
eVector
+
pQVec
.
eVector
);
return
QuantityVector
<
dim
>
(
eVector
+
pQVec
.
eVector
);
...
...
This diff is collapsed.
Click to expand it.
Framework/Geometry/Sphere.h
0 → 100644
+
27
−
0
View file @
853ddcee
#ifndef SPHERE_H_
#define SPHERE_H_
#include
"Point.h"
#include
<phys/units/quantity.hpp>
class
Sphere
{
using
Length
=
phys
::
units
::
quantity
<
phys
::
units
::
length_d
,
double
>
;
Point
center
;
Length
const
radius
;
public:
Sphere
(
Point
const
&
pCenter
,
Length
const
pRadius
)
:
center
(
pCenter
),
radius
(
pRadius
)
{
}
auto
isInside
(
Point
const
&
p
)
const
{
return
radius
*
radius
>
(
center
-
p
).
squaredNorm
();
}
};
#endif
This diff is collapsed.
Click to expand it.
Framework/Geometry/Vector.h
+
22
−
0
View file @
853ddcee
...
@@ -49,6 +49,28 @@ public:
...
@@ -49,6 +49,28 @@ public:
return
BaseVector
<
dim
>::
qVector
.
norm
();
return
BaseVector
<
dim
>::
qVector
.
norm
();
}
}
auto
squaredNorm
()
const
{
return
BaseVector
<
dim
>::
qVector
.
squaredNorm
();
}
template
<
typename
dim2
>
auto
parallelProjectionOnto
(
BaseVector
<
dim2
>
const
&
pVec
,
CoordinateSystem
const
&
pCS
)
const
{
auto
const
ourCompVec
=
getComponents
(
pCS
);
auto
const
otherCompVec
=
pVec
.
getComponents
(
pVec
);
auto
const
&
a
=
ourCompVec
.
eVector
;
auto
const
&
b
=
otherCompVec
.
eVector
;
return
Vector
<
dim
>
(
pCS
,
(
a
*
b
)
/
b
.
squaredNorm
()
*
b
);
}
template
<
typename
dim2
>
auto
parallelProjectionOnto
(
BaseVector
<
dim2
>
const
&
pVec
)
{
return
parallelProjectionOnto
<
dim2
>
(
pVec
,
*
BaseVector
<
dim
>::
cs
);
}
//~ template <typename dim2>
//~ template <typename dim2>
//~ auto operator*(Vector<dim2> const& pVec)
//~ auto operator*(Vector<dim2> const& pVec)
//~ {
//~ {
...
...
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