Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120274252
union.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jul 3, 04:24
Size
3 KB
Mime Type
text/x-c++
Expires
Sat, Jul 5, 04:24 (2 d)
Engine
blob
Format
Raw Data
Handle
27165253
Attached To
rCADDMESH CADD_mesher
union.cc
View Options
/**
* @file union.cc
* @author Till Junge <till.junge@epfl.ch>
* @date Thu Jul 3 11:39:35 2014
*
* @brief
*
* @section LICENSE
*
* <insert lisence here>
*
*/
/* -------------------------------------------------------------------------- */
#include <stdexcept>
#include "union.hh"
/* -------------------------------------------------------------------------- */
template <Uint DIM>
Union<DIM>::Union(const Geometry<DIM> & geomA, const Geometry<DIM>& geomB,
std::string name)
:Geometry<DIM>(name), geomA(*geomA.resolveType()), geomB(*geomB.resolveType())
{}
/* -------------------------------------------------------------------------- */
template <Uint DIM>
Union<DIM>::Union(const Union<DIM> & other)
:Geometry<DIM>(other.get_name()), geomA(*other.getGeomA().resolveType()),
geomB(*other.getGeomB().resolveType()) {}
/* -------------------------------------------------------------------------- */
template <Uint DIM>
Union<DIM>::~Union() {
delete &this->geomA;
delete &this->geomB;
}
/* -------------------------------------------------------------------------- */
template <Uint DIM>
void Union<DIM>::printself(std::ostream & stream, int indent) const {
indent_space(stream, indent);
stream << "Union of the following geometries:" << std::endl;
indent_space(stream, indent);
stream << " " << this->geomA.get_name() << std::endl;
indent_space(stream, indent);
stream << " " << this->geomB.get_name() << std::endl;
}
/* -------------------------------------------------------------------------- */
template <Uint DIM>
void Union<DIM>::shift(const PointRef<DIM> & offset) {
this->geomA.shift(offset);
this->geomB.shift(offset);
}
/* -------------------------------------------------------------------------- */
template <Uint DIM>
Geometry<DIM> * Union<DIM>::resolveType() const {
return newGeom<DIM>(*this);
}
/* -------------------------------------------------------------------------- */
template <Uint DIM>
bool Union<DIM>::is_inside(const Real * point, Real tol) const {
return this->geomA.is_inside(point, tol) && this->geomA.is_inside(point, tol);
}
/* -------------------------------------------------------------------------- */
template <Uint DIM>
InsideObject Union<DIM>::from_border(const Real * point, Real tol) const {
InsideObject ioA = this->geomA.from_border(point, tol);
InsideObject ioB = this->geomB.from_border(point, tol);
if (ioA.distance < ioB.distance) {
return ioA;
} else {
return ioB;
}
}
/* -------------------------------------------------------------------------- */
template<Uint DIM>
Real Union<DIM>::min_in_direction(const Real * dir, const Real & unit) const {
Real min = this->geomA.min_in_direction(dir, unit);
keep_min(min, this->geomB.min_in_direction(dir, unit));
return min;
}
/* -------------------------------------------------------------------------- */
template<Uint DIM>
Real Union<DIM>::max_in_direction(const Real * dir, const Real & unit) const {
Real max = this->geomA.max_in_direction(dir, unit);
keep_max(max, this->geomB.max_in_direction(dir, unit));
return max;
}
/* -------------------------------------------------------------------------- */
template class Union<twoD>;
template class Union<threeD>;
Event Timeline
Log In to Comment