Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tools
frackit
Commits
5f6dd320
Commit
5f6dd320
authored
Jan 18, 2020
by
Dennis Gläser
Browse files
[constraints] allow for exchangeable angle computation engine
parent
b5ad445c
Changes
5
Show whitespace changes
Inline
Side-by-side
frackit/entitynetwork/constraints.hh
View file @
5f6dd320
...
...
@@ -42,6 +42,21 @@
namespace
Frackit
{
/*!
* \brief Forward declaration of the constraints class.
*/
template
<
class
ST
=
double
,
class
AE
=
IntersectionAngle
<
ST
>
>
class
EntityNetworkConstraints
;
/*!
* \brief Convenience function to construct an instance
* of the constraints class using the default engines
*/
template
<
class
ST
=
double
>
EntityNetworkConstraints
<
ST
>
makeDefaultConstraints
()
{
return
EntityNetworkConstraints
<
ST
>
(
IntersectionAngle
<
ST
>
());
}
/*!
* \brief Class which defines and checks constraints on
* the geometric relationships between entities of
...
...
@@ -57,10 +72,12 @@ namespace Frackit {
* zero distance. However, this case is admissible, only small features
* related to the non-intersecting boundaries are of interest here.
* \tparam ST The type used for the scalar constraint values
* \tparam AE The engine used for angle computations between intersecting geometries
* \tparam AE The engine used for angle computations between intersecting geometries.
* This engine is required to return the angle between geometries when
* the operator() is called with the two geometries and the intersection
* result as arguments.
*/
template
<
class
ST
=
double
,
class
AE
=
IntersectionAngle
<
ST
>
>
template
<
class
ST
,
class
AE
>
class
EntityNetworkConstraints
{
...
...
@@ -72,10 +89,12 @@ public:
using
AngleComputationEngine
=
AE
;
/*!
* \brief Default constructor, deactivates all constraints.
* \brief The constructor.
* \param angleEngine An instance of the engine used for angle computations.
*/
EntityNetworkConstraints
()
:
minDistance_
(),
minIsAngle_
()
EntityNetworkConstraints
(
const
AngleComputationEngine
&
angleEngine
)
:
angleEngine_
(
angleEngine
)
,
minDistance_
(),
minIsAngle_
()
,
minIsMagnitude_
(),
minIsDistance_
()
,
useMinDistance_
(
false
),
useMinIsAngle_
(
false
)
,
useMinIsMagnitude_
(
false
),
useMinIsDistance_
(
false
)
...
...
@@ -85,28 +104,6 @@ public:
allowEquiDimIS_
=
false
;
}
/*!
* \brief The constructor defining all constraints
* \param minDistance Minimum distance allowed between two (non-intersecting) entities
* \param minIsAngle Minimum angle in which two entities are allowed to intersect
* \param minIsMagnitude Minimum magnitude of intersection allowed
* \param minIsDistance Minimum distance of an intersection to intersecting entity boundaries
* \note The default epsilon is set to be used for intersection computations
*/
EntityNetworkConstraints
(
Scalar
minDistance
,
Scalar
minIsAngle
,
Scalar
minIsMagnitude
,
Scalar
minIsDistance
)
:
minDistance_
(
minDistance
),
minIsAngle_
(
minIsAngle
)
,
minIsMagnitude_
(
minIsMagnitude
),
minIsDistance_
(
minIsDistance
)
,
useMinDistance_
(
false
),
useMinIsAngle_
(
false
)
,
useMinIsMagnitude_
(
false
),
useMinIsDistance_
(
false
)
,
intersectionEps_
(),
useIntersectionEps_
(
false
)
{
// per default, we do not allow equi-dimensional intersections
allowEquiDimIS_
=
false
;
}
//! Set the constraint for the minimum distance between entities
void
setMinDistance
(
Scalar
minDistance
)
{
...
...
@@ -164,6 +161,13 @@ public:
void
allowEquiDimensionalIntersections
(
bool
value
)
{
allowEquiDimIS_
=
value
;
}
/*!
* \brief Set the engine used for angle computations
* \param angleEngine An instance of the engine
*/
void
setAngleComputationEngine
(
const
AngleComputationEngine
&
angleEngine
)
{
angleEngine_
=
angleEngine
;
}
/*!
* \brief Check if a pair of geometries fulfills the constraints
* \param geo1 The first geometry
...
...
@@ -233,6 +237,8 @@ public:
}
private:
AngleComputationEngine
angleEngine_
;
//! Algorithms to compute angles between intersecting geometries
Scalar
minDistance_
;
//!< Minimum distance allowed between two entities
Scalar
minIsAngle_
;
//!< Minimum angle in which two entities are allowed to intersect
Scalar
minIsMagnitude_
;
//!< Minimum magnitude of the intersection geometry
...
...
@@ -248,7 +254,6 @@ private:
Scalar
intersectionEps_
;
//! Tolerance value to be used for intersections
bool
useIntersectionEps_
;
//! Stores wether or not a user-defined epsilon value was set
AngleComputationEngine
angleEngine_
;
//! Algorithms to compute angles between intersecting geometries
};
}
// end namespace Frackit
...
...
test/entitynetwork/test_constraints_cylindersurface.cc
View file @
5f6dd320
...
...
@@ -23,7 +23,7 @@ int main()
const
Vector
e3
(
0.0
,
0.0
,
1.0
);
// Define constraints
Frackit
::
EntityNetwork
Constraints
<
ctype
>
constraints
;
auto
constraints
=
Frackit
::
makeDefault
Constraints
<
ctype
>
()
;
constraints
.
setMinDistance
(
0.1
);
constraints
.
setMinIntersectingAngle
(
M_PI
/
4.0
);
constraints
.
setMinIntersectionMagnitude
(
0.05
);
...
...
test/entitynetwork/test_constraints_disk.cc
View file @
5f6dd320
...
...
@@ -22,7 +22,7 @@ int main()
const
Vector
e3
(
0.0
,
0.0
,
1.0
);
// Define constraints
Frackit
::
EntityNetwork
Constraints
<
ctype
>
constraints
;
auto
constraints
=
Frackit
::
makeDefault
Constraints
<
ctype
>
()
;
constraints
.
setMinDistance
(
0.1
);
constraints
.
setMinIntersectingAngle
(
M_PI
/
4.0
);
constraints
.
setMinIntersectionMagnitude
(
0.05
);
...
...
test/entitynetwork/test_generate_disk_network_cylinder.cc
View file @
5f6dd320
...
...
@@ -54,9 +54,9 @@ int main()
std
::
vector
<
Disk
>
diskSet2
;
//! enforce some constraints on the network
Frackit
::
EntityNetworkConstraints
<
ctype
>
c
onstraints
OnSelf
;
Frackit
::
EntityNetworkConstraints
<
ctype
>
c
onstraints
OnOther
;
Frackit
::
EntityNetworkConstraints
<
ctype
>
constraintsOnDomain
;
auto
constraintsOnSelf
=
makeDefaultC
onstraints
<
ctype
>
()
;
auto
constraintsOnOther
=
makeDefaultC
onstraints
<
ctype
>
()
;
auto
constraintsOnDomain
=
makeDefaultConstraints
<
ctype
>
()
;
// constraints among disks of the same set
constraintsOnSelf
.
setMinDistance
(
0.1
);
...
...
test/entitynetwork/test_generate_disk_network_shape.cc
View file @
5f6dd320
...
...
@@ -76,9 +76,9 @@ int main(int argc, char** argv)
std
::
vector
<
Disk
>
diskSet2
;
//! enforce some constraints on the network
Frackit
::
EntityNetworkConstraints
<
ctype
>
c
onstraints
OnSelf
;
Frackit
::
EntityNetworkConstraints
<
ctype
>
c
onstraints
OnOther
;
Frackit
::
EntityNetworkConstraints
<
ctype
>
constraintsOnDomain
;
auto
constraintsOnSelf
=
makeDefaultC
onstraints
<
ctype
>
()
;
auto
constraintsOnOther
=
makeDefaultC
onstraints
<
ctype
>
()
;
auto
constraintsOnDomain
=
makeDefaultConstraints
<
ctype
>
()
;
// constraints among disks of the same set
constraintsOnSelf
.
setMinDistance
(
10.0
);
...
...
Write
Preview
Supports
Markdown
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