47 typedef memory::shared_ptr<gsPlanarDomain> Ptr;
48 typedef memory::unique_ptr<gsPlanarDomain> uPtr;
56 if ( boundary->is_ccw() )
58 m_loops.push_back(boundary);
63 m_loops.push_back(boundary);
86 : m_loops( other.m_loops.size() )
88 m_bbox = other.m_bbox;
89 cloneAll( other.m_loops.begin(), other.m_loops.end(),
90 this->m_loops.begin() );
98 m_loops.resize( other.m_loops.size() );
99 m_bbox = other.m_bbox;
100 cloneAll( other.m_loops.begin(), other.m_loops.end(),
101 this->m_loops.begin() );
116 if ( !m_loops[0]->is_ccw() )
117 gsWarn<<
"Wrong orientation in outer loop of planar domain.";
118 for(
size_t i=1; i< m_loops.size(); i++)
120 if( m_loops[i]->is_ccw())
121 gsWarn<<
"Wrong orientation in loop["<< i <<
"] of planar domain.";
125 void insertHole( gsCurveLoop<T> * hole )
127 if ( hole->is_ccw() )
131 m_loops.push_back( hole );
134 int numLoops()
const {
return m_loops.size(); }
135 int numHoles()
const {
return m_loops.size() -1; }
137 gsCurveLoop<T> & outer() {
return loop(0); }
138 const gsCurveLoop<T> & outer()
const {
return loop(0); }
140 gsCurveLoop<T> & loop(
unsigned loopNumber)
142 GISMO_ASSERT( loopNumber<m_loops.size(),
"Loop does not exist" );
143 return *m_loops[loopNumber];
145 const gsCurveLoop<T> & loop(
unsigned loopNumber)
const
147 GISMO_ASSERT( loopNumber<m_loops.size(),
"Loop does not exist" );
148 return *m_loops[loopNumber];
151 gsCurve<T> & curve(
unsigned loopNumber,
unsigned curveNumber)
153 GISMO_ASSERT( loopNumber<m_loops.size(),
"Loop does not exist" );
154 return m_loops[loopNumber]->curve(curveNumber);
156 const gsCurve<T> & curve(
unsigned loopNumber,
unsigned curveNumber)
const
158 GISMO_ASSERT( loopNumber<m_loops.size(),
"Loop does not exist" );
159 return m_loops[loopNumber]->curve(curveNumber);
162 bool contains( gsVector<T>
const &, T)
167 gsMatrix<T> boundingBox()
const
169 gsMatrix<T> res(2,2);
171 res = m_loops[0]->getBoundingBox();
175 void translate(gsVector<T>
const & v)
177 for (
typename std::vector< gsCurveLoop<T> *>::iterator it =
178 m_loops.begin(); it != m_loops.end(); ++it)
187 bool inDomain( gsMatrix<T>
const & u,
int direction = 0);
191 bool onBoundary(gsMatrix<T>
const & u);
194 std::ostream &
print(std::ostream &os)
const;
196 friend std::ostream& operator<<(std::ostream& os,
const gsPlanarDomain& pd) {
return pd.print(os); }
199 void sampleLoop_into(
int loopID,
int npoints,
int numEndPoints, gsMatrix<T> & u );
201 gsMatrix<T> sampleLoop(
int loopID,
int npoints=50,
int numEndPoints=2)
208 void sampleCurve_into(
int loopID,
int curveID,
int npoints, gsMatrix<T> & u );
210 gsMatrix<T> sampleCurve(
int loopID,
int curveID,
int npoints = 50)
213 sampleCurve_into( loopID, curveID, npoints, u );
218 memory::unique_ptr<gsMesh<T> >
toMesh(
int npoints = 50)
const;
222 uPtr
split(
int startIndex,
int endIndex,
225 typename gsCurveLoop<T>::uPtr newCurveLoop = this->m_loops[0]->split(startIndex, endIndex, newCurveThisFace, newCurveNewFace);
239 assert(!m_loops.empty());
240 m_bbox = m_loops[0]->getBoundingBox();
249 return m_loops[loopId]->splitCurve(curveId,lengthRatio);
258 std::vector< gsCurveLoop<T> *> m_loops;
265 # define Eigen gsEigen
266 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
274 #ifndef GISMO_BUILD_LIB
275 #include GISMO_HPP_HEADER(gsPlanarDomain.hpp)
Provides definition of gsTemplate class.
void sampleLoop_into(int loopID, int npoints, int numEndPoints, gsMatrix< T > &u)
linearly discriti
Definition: gsPlanarDomain.hpp:169
#define GISMO_NO_IMPLEMENTATION
Definition: gsDebug.h:129
Abstract base class representing a curve.
Definition: gsCurve.h:30
memory::unique_ptr< gsMesh< T > > toMesh(int npoints=50) const
Return a triangulation of the planar domain.
Definition: gsPlanarDomain.hpp:248
void updateBoundingBox()
Definition: gsPlanarDomain.h:237
gsPlanarDomain(gsCurve< T > *boundary)
Construct planar domain by an outer boundary given by a curve.
Definition: gsPlanarDomain.h:73
Struct that defines the boundary sides and corners and types of a geometric object.
Definition: gsBoundary.h:55
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
void cloneAll(It start, It end, ItOut out)
Clones all pointers in the range [start end) and stores new raw pointers in iterator out...
Definition: gsMemory.h:295
uPtr clone() const
Clone function. Used to make a copy of the (derived) geometry.
Definition: gsPlanarDomain.h:107
gsMatrix< T > splitCurve(size_t loopId, size_t curveId, T lengthRatio=.5)
Definition: gsPlanarDomain.h:247
#define gsWarn
Definition: gsDebug.h:50
memory::unique_ptr< gsCurveLoop > uPtr
Unique pointer for gsCurveLoop.
Definition: gsCurveLoop.h:47
GISMO_DEPRECATED index_t direction(index_t s)
Returns the parametric direction that corresponds to side s.
Definition: gsBoundary.h:1048
gsPlanarDomain()
Default empty constructor.
Definition: gsPlanarDomain.h:51
void freeAll(It begin, It end)
Frees all pointers in the range [begin end)
Definition: gsMemory.h:312
gsPlanarDomain(const gsPlanarDomain &other)
Copy constructor.
Definition: gsPlanarDomain.h:85
Class representing a Planar domain with an outer boundary and a number of holes.
Definition: gsPlanarDomain.h:43
gsPlanarDomain(gsCurveLoop< T > *boundary)
Construct planar domain by giving the outer boundary.
Definition: gsPlanarDomain.h:54
gsPlanarDomain & operator=(const gsPlanarDomain &other)
Assignment operator.
Definition: gsPlanarDomain.h:95
A closed loop given by a collection of curves.
Definition: gsCurveLoop.h:36
Interface for gsCurveLoop class, representing a loop of curves, in anticlockwise order.
uPtr split(int startIndex, int endIndex, gsCurve< T > *newCurveThisFace, gsCurve< T > *newCurveNewFace)
Definition: gsPlanarDomain.h:222
std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition: gsPlanarDomain.hpp:151