PLaSK library
Loading...
Searching...
No Matches
plask::Polygon Struct Reference

#include <plask/geometry/polygon.hpp>

Inheritance diagram for plask::Polygon:
[legend]
Collaboration diagram for plask::Polygon:
[legend]

Public Types

typedef GeometryObjectLeaf< 2 > BaseClass
 
typedef BaseClass::DVec DVec
 Vector of doubles type in space on this, vector in space with dim number of dimensions.
 
typedef BaseClass::Box Box
 Rectangle type in space on this, rectangle in space with dim number of dimensions.
 
- Public Types inherited from plask::GeometryObjectLeaf< 2 >
typedef GeometryObjectD< dim >::DVec DVec
 
typedef GeometryObjectD< dim >::Box Box
 
- Public Types inherited from plask::GeometryObjectD< dim >
typedef Primitive< dim >::Box Box
 
typedef Primitive< dim >::DVec DVec
 
- Public Types inherited from plask::GeometryObject
enum  Type {
  TYPE_LEAF = 0 , TYPE_TRANSFORM = 1 , TYPE_SPACE_CHANGER = 2 , TYPE_CONTAINER = 3 ,
  TYPE_GEOMETRY = 4 , TYPE_SEPARATOR = 5
}
 Type of geometry object. More...
 
typedef std::function< bool(const GeometryObject &)> Predicate
 Predicate on GeometryObject.
 

Public Member Functions

std::string getTypeName () const override
 Get name of object type (like: "block2d", "shelf", "stack3d", etc.).
 
 Polygon ()=default
 Construct an empty polygon.
 
 Polygon (const std::vector< Vec< 2 > > &vertices, const shared_ptr< Material > &material=shared_ptr< Material >())
 Construct a polygon with vertices at specified points.
 
 Polygon (std::vector< Vec< 2 > > &&vertices, const shared_ptr< Material > &&material=shared_ptr< Material >())
 Construct a polygon with vertices at specified points.
 
 Polygon (std::initializer_list< Vec< 2 > > vertices, const shared_ptr< Material > &material=shared_ptr< Material >())
 Construct a polygon with vertices at specified points.
 
 Polygon (const std::vector< Vec< 2 > > &vertices, shared_ptr< MaterialsDB::MixedCompositionFactory > materialTopBottom)
 Construct a polygon with vertices at specified points.
 
 Polygon (std::vector< Vec< 2 > > &&vertices, shared_ptr< MaterialsDB::MixedCompositionFactory > materialTopBottom)
 Construct a polygon with vertices at specified points.
 
 Polygon (std::initializer_list< Vec< 2 > > vertices, shared_ptr< MaterialsDB::MixedCompositionFactory > materialTopBottom)
 Construct a polygon with vertices at specified points.
 
 Polygon (const Polygon &src)
 Copy-constructor.
 
const std::vector< Vec< 2 > > & getVertices () const
 Get the polygon vertices.
 
std::vector< Vec< 2 > > & getVertices ()
 Get the polygon vertices.
 
void setVertices (const std::vector< Vec< 2 > > &vertices)
 Set the polygon vertices.
 
void setVertices (std::vector< Vec< 2 > > &&vertices)
 Set the polygon vertices.
 
void setVertex (unsigned index, const Vec< 2 > &vertex)
 Set one polygon vertex.
 
void insertVertex (unsigned index, const Vec< 2 > &vertex)
 Insert a new vertex to the polygon.
 
void addVertex (const Vec< 2 > &vertex)
 Add a new vertex to the polygon.
 
void removeVertex (unsigned index)
 Remove a vertex from the polygon.
 
void clearVertices ()
 Clear all vertices from the polygon.
 
unsigned getVertexCount () const
 Get the number of vertices in the polygon.
 
const Vec< 2 > & getVertex (unsigned index) const
 Get the vertex at specified index.
 
void validate () const override
 Check if object is ready for calculation.
 
Box getBoundingBox () const override
 Calculate minimal rectangle which contains all points of geometry object.
 
bool contains (const DVec &p) const override
 Check if this geometry object contains point.
 
shared_ptr< GeometryObjectshallowCopy () const override
 Get shallow copy of this.
 
void addPointsAlongToSet (std::set< double > &points, Primitive< 3 >::Direction direction, unsigned max_steps, double min_step_size) const override
 
void addLineSegmentsToSet (std::set< typename GeometryObjectD< 2 >::LineSegment > &segments, unsigned max_steps, double min_step_size) const override
 
void writeXMLAttr (XMLWriter::Element &dest_xml_object, const AxisNames &axes) const override
 Append XML attributes of this to dest_xml_object.
 
- Public Member Functions inherited from plask::GeometryObjectLeaf< 2 >
GeometryReaderreadMaterial (GeometryReader &src)
 
 GeometryObjectLeaf ()
 Construct leaf with uninitialized material (all material getting methods returns nullptr).
 
 GeometryObjectLeaf (const GeometryObjectLeaf< dim > &src)
 Copy-constructor.
 
 GeometryObjectLeaf (shared_ptr< Material > material)
 Construct leaf which uses solid material.
 
 GeometryObjectLeaf (shared_ptr< MaterialsDB::MixedCompositionFactory > materialTopBottom)
 Construct leaf which uses linearly changeble material.
 
shared_ptr< MaterialgetRepresentativeMaterial () const
 Get representative material of this leaf (typically material which is returned in center of object).
 
shared_ptr< MaterialsingleMaterial () const
 Get material only if it this leaf is solid (has assign exactly one material).
 
void setMaterial (shared_ptr< Material > new_material)
 Set new, solid on all surface, material.
 
void setMaterialFast (shared_ptr< Material > new_material)
 Set new, solid on all surface, material.
 
void setMaterialTopBottomCompositionFast (shared_ptr< MaterialsDB::MixedCompositionFactory > materialTopBottom)
 Set new graded material.
 
void setMaterialTopBottomComposition (shared_ptr< MaterialsDB::MixedCompositionFactory > materialTopBottom)
 Set new material material.
 
void setMaterialDraftTopBottomCompositionFast (shared_ptr< MaterialsDB::MixedCompositionFactory > materialTopBottom)
 Set new draft graded material.
 
void setMaterialProviderFast (MaterialProvider *provider)
 Set new custom material provider.
 
void setMaterialProvider (MaterialProvider *provider)
 Set new custom material provider.
 
const MaterialProvider * getMaterialProvider () const
 Return pointer to the material provider.
 
GeometryObject::Type getType () const override
 Check if geometry is: leaf, transform or container type object.
 
shared_ptr< MaterialgetMaterial (const DVec &p) const override
 Return material in a given point inside the geometry object.
 
void getBoundingBoxesToVec (const GeometryObject::Predicate &predicate, std::vector< Box > &dest, const PathHints *path=0) const override
 Calculate and append to vector bounding boxes of all nodes which fulfill given predicate, optionally marked by path.
 
void getObjectsToVec (const GeometryObject::Predicate &predicate, std::vector< shared_ptr< const GeometryObject > > &dest, const PathHints *path=0) const override
 Append all objects from subtree with this in root, which fulfill predicate to vector dest.
 
void getPositionsToVec (const GeometryObject::Predicate &predicate, std::vector< DVec > &dest, const PathHints *=0) const override
 Calculate and append to vector positions of all nodes which fulfill given predicate, optionally marked by path.
 
bool hasInSubtree (const GeometryObject &el) const override
 Check if el is in subtree with this in root.
 
GeometryObject::Subtree getPathsTo (const GeometryObject &el, const PathHints *path=0) const override
 Find paths to el.
 
GeometryObject::Subtree getPathsAt (const DVec &point, bool=false) const override
 Find all paths to objects which lies at given point.
 
std::size_t getChildrenCount () const override
 Get number of all children of this in geometry graph.
 
shared_ptr< GeometryObjectgetChildNo (std::size_t child_no) const override
 Get child with given index.
 
shared_ptr< const GeometryObjectchangedVersion (const GeometryObject::Changer &changer, Vec< 3, double > *translation=0) const override
 Get this or copy of this with some changes in subtree.
 
shared_ptr< GeometryObjectdeepCopy (std::map< const GeometryObject *, shared_ptr< GeometryObject > > &copied) const override
 Get deep copy of this.
 
- Public Member Functions inherited from plask::GeometryObjectD< dim >
int getDimensionsCount () const override
 Get number of dimensions.
 
virtual DVec getBoundingBoxSize () const
 
virtual Box getRealBoundingBox () const
 Calculate minimal rectangle which contains all points of real geometry object.
 
shared_ptr< MaterialgetMaterialOrAir (const DVec &p) const
 Return material in a given point inside the geometry object.
 
void getBoundingBoxesToVec (const GeometryObject::Predicate &predicate, std::vector< Box > &dest, const PathHints &path) const
 Calculate and append to vector bounding boxes of all nodes which fulfill given predicate, marked by path.
 
std::vector< BoxgetBoundingBoxes (const GeometryObject::Predicate &predicate, const PathHints *path=0) const
 Calculate the vector of bounding boxes of all nodes which fulfill given predicate, optionally marked by path.
 
std::vector< BoxgetBoundingBoxes (const GeometryObject::Predicate &predicate, const PathHints &path)
 Calculate the vector of bounding boxes of all nodes which fulfill given predicate, marked by path.
 
void getLeafsBoundingBoxesToVec (std::vector< Box > &dest, const PathHints *path=0) const
 Calculate and append to vector bounding boxes of all leafs, optionally marked by path.
 
void getLeafsBoundingBoxesToVec (std::vector< Box > &dest, const PathHints &path) const
 Calculate and append to vector bounding boxes of all leafs, marked by path.
 
std::vector< BoxgetLeafsBoundingBoxes (const PathHints *path=0) const
 Calculate bounding boxes of all leafs, optionally marked by path.
 
std::vector< BoxgetLeafsBoundingBoxes (const PathHints &path) const
 Calculate bounding boxes of all leafs, marked by path.
 
void getObjectBoundingBoxesToVec (std::vector< Box > &dest, const GeometryObject &object, const PathHints *path=0) const
 Calculate and append to vector bounding boxes of all instances of given object, optionally marked by path.
 
void getObjectBoundingBoxesToVec (std::vector< Box > &dest, const GeometryObject &object, const PathHints &path) const
 Calculate and append to vector bounding boxes of all instances of given object, marked by path.
 
std::vector< BoxgetObjectBoundingBoxes (const GeometryObject &object, const PathHints *path=0) const
 Calculate bounding boxes of all instances of given object, optionally marked by path.
 
std::vector< BoxgetObjectBoundingBoxes (const GeometryObject &object, const PathHints &path) const
 Calculate bounding boxes of all instances of given objects, marked by path.
 
void getPositionsToVec (const Predicate &predicate, std::vector< DVec > &dest, const PathHints &path) const
 Calculate and append to vector positions of all nodes which fulfill given predicate, marked by path.
 
std::vector< DVecgetPositions (const Predicate &predicate, const PathHints *path=0) const
 Calculate and append to vector positions of all nodes which fulfill given predicate, optionally marked by path.
 
std::vector< DVecgetPositions (const Predicate &predicate, const PathHints &path) const
 Calculate and append to vector positions of all nodes which fulfill given predicate, marked by path.
 
void getLeafsPositionsToVec (std::vector< DVec > &dest, const PathHints *path=0) const
 Calculate and append to vector positions of all leafs, optionally marked by path.
 
void getLeafsPositionsToVec (std::vector< DVec > &dest, const PathHints &path) const
 Calculate and append to vector positions of all leafs, marked by path.
 
std::vector< DVecgetLeafsPositions (const PathHints *path=0) const
 Calculate and return a vector of positions of all leafs, optionally marked by path.
 
std::vector< DVecgetLeafsPositions (const PathHints &path) const
 Calculate and return a vector of positions of all leafs, marked by path.
 
void getObjectPositionsToVec (std::vector< DVec > &dest, const GeometryObject &object, const PathHints *path=0) const
 Calculate and append to vector positions of all instances of given object, optionally marked by path.
 
void getObjectPositionsToVec (std::vector< DVec > &dest, const GeometryObject &object, const PathHints &path) const
 Calculate and append to vector positions of all instances of given object, marked by path.
 
std::vector< DVecgetObjectPositions (const GeometryObject &object, const PathHints *path=0) const
 Calculate and return a vector of positions of all instances of given object, optionally marked by path.
 
std::vector< DVecgetObjectPositions (const GeometryObject &object, const PathHints &path) const
 Calculate and return a vector of positions of all instances of given object, marked by path.
 
shared_ptr< const GeometryObjectgetMatchingAt (const DVec &point, const Predicate &predicate, const PathHints *path=0) const
 Get object closest to the root, which contains specific point and fulfills the predicate.
 
shared_ptr< const GeometryObjectgetMatchingAt (const DVec &point, const Predicate &predicate, const PathHints &path) const
 Get object closest to the root, which contains specific point and fulfills the predicate.
 
bool objectIncludes (const GeometryObject &object, const PathHints *path, const DVec &point) const
 Check if specified geometry object contains a point point.
 
bool objectIncludes (const GeometryObject &object, const PathHints &path, const DVec &point) const
 Check if specified geometry object contains a point point.
 
bool objectIncludes (const GeometryObject &object, const DVec &point) const
 Check if specified geometry object contains a point point.
 
std::set< std::string > getRolesAt (const DVec &point, const plask::PathHints *path=0) const
 Get a sum of roles sets of all objects which lies on path from this to leaf at given point.
 
std::set< std::string > getRolesAt (const DVec &point, const plask::PathHints &path) const
 Get a sum of roles sets of all objects which lies on path from this to leaf at given point.
 
shared_ptr< const GeometryObjecthasRoleAt (const std::string &role_name, const DVec &point, const plask::PathHints *path=0) const
 Check if any object at given point, not hidden by another object, plays role with given name role_name (if so, returns non-nullptr).
 
shared_ptr< const GeometryObjecthasRoleAt (const std::string &role_name, const DVec &point, const plask::PathHints &path) const
 Check if any object at given point, not hidden by another object, plays role with given name role_name (if so, returns non-nullptr).
 
virtual void addLineSegmentsToSet (std::set< LineSegment > &PLASK_UNUSED(segments), unsigned PLASK_UNUSED(max_steps), double PLASK_UNUSED(min_step_size)) const =0
 Add characteristic points to the set and edges connecting them.
 
std::set< LineSegmentgetLineSegments (unsigned max_steps=PLASK_GEOMETRY_MAX_STEPS, double min_step_size=PLASK_GEOMETRY_MIN_STEP_SIZE) const
 Add characteristic points to the set and edges connecting them.
 
- Public Member Functions inherited from plask::GeometryObject
void setMaxSteps (unsigned value)
 Set max_steps.
 
void setMinStepSize (double value)
 Set min_step_size.
 
template<typename ClassT , typename methodT >
boost::signals2::connection changedConnectMethod (ClassT *obj, methodT method, boost::signals2::connect_position at=boost::signals2::at_back)
 Connect a method to changed signal.
 
template<typename ClassT , typename methodT >
void changedDisconnectMethod (ClassT *obj, methodT method)
 Disconnect a method from changed signal.
 
template<typename EventT = Event, typename... Args>
void fireChanged (Args &&... event_constructor_params_without_source)
 Call changed with this as event source.
 
 GeometryObject (const GeometryObject &to_copy)
 Initialize this to be the same as to_copy but doesn't have any changes observer.
 
GeometryObjectoperator= (const GeometryObject &to_copy)
 Set this to be the same as to_copy but doesn't change changes observer.
 
 GeometryObject ()
 
 GeometryObject (unsigned max_steps, double min_step_size)
 
virtual ~GeometryObject ()
 Virtual destructor.
 
virtual void writeXML (XMLWriter::Element &parent_xml_object, WriteXMLCallback &write_cb, AxisNames parent_axes) const
 Write geometry tree branch rooted by this to XML.
 
void writeXML (XMLWriter::Element &parent_xml_object, WriteXMLCallback &write_cb) const
 Write geometry tree branch rooted by this to XML.
 
void writeXML (XMLWriter::Element &parent_xml_object) const
 Write geometry tree branch rooted by this to XML.
 
template<int DIMS>
shared_ptr< GeometryObjectD< DIMS > > asD ()
 Cast this to GeometryObjectD<DIMS>.
 
template<int DIMS>
shared_ptr< const GeometryObjectD< DIMS > > asD () const
 Cast this to GeometryObjectD<DIMS> (const version).
 
shared_ptr< GeometryasGeometry ()
 Cast this to Geometry.
 
shared_ptr< const GeometryasGeometry () const
 Cast this to Geometry.
 
bool isLeaf () const
 
bool isTransform () const
 
bool isSpaceChanger () const
 
bool isContainer () const
 
bool isGeometry () const
 
virtual void addPointsAlongToSet (std::set< double > &points, Primitive< 3 >::Direction PLASK_UNUSED(direction), unsigned PLASK_UNUSED(max_steps), double PLASK_UNUSED(min_step_size)) const =0
 Add characteristic points information along specified axis to set.
 
std::set< doublegetPointsAlong (Primitive< 3 >::Direction direction, unsigned max_steps=PLASK_GEOMETRY_MAX_STEPS, double min_step_size=PLASK_GEOMETRY_MIN_STEP_SIZE) const
 Get characteristic points information along specified axis.
 
bool hasRole (std::string role_name) const
 Check if this object belongs to class (has tag) with name role_name.
 
void addRole (std::string role_name)
 Add this to given class.
 
void removeRole (std::string role_name)
 Remove this from given class, do nothing if this is not in given class.
 
void clearRoles ()
 Clear set of roles of this.
 
bool hasInSubtree (const GeometryObject &el, const PathHints *pathHints) const
 
bool hasInSubtree (shared_ptr< const GeometryObject > el, const PathHints *pathHints) const
 
void getObjectsToVec (const Predicate &predicate, std::vector< shared_ptr< const GeometryObject > > &dest, const PathHints &path) const
 Append all objects from subtree with this in root, which fulfill predicate to vector dest.
 
std::vector< shared_ptr< const GeometryObject > > getObjects (const Predicate &predicate, const PathHints *path=0) const
 Get vector of all objects from subtree with this in root, which fulfill predicate.
 
std::vector< shared_ptr< const GeometryObject > > getObjects (const Predicate &predicate, const PathHints &path) const
 Get vector of all objects from subtree with this in root, which fulfill predicate.
 
void getLeafsToVec (std::vector< shared_ptr< const GeometryObject > > &dest, const PathHints *path=0) const
 Append all leafs in subtree with this in root to vector dest.
 
void getLeafsToVec (std::vector< shared_ptr< const GeometryObject > > &dest, const PathHints &path) const
 Append all leafs in subtree with this in root to vector dest.
 
std::vector< shared_ptr< const GeometryObject > > getLeafs (const PathHints *path=0) const
 Get all leafs in subtree with this object as root.
 
std::vector< shared_ptr< const GeometryObject > > getLeafs (const PathHints &path) const
 Get all leafs in subtree with this object as root.
 
void getObjectsWithRoleToVec (const std::string &role, std::vector< shared_ptr< const GeometryObject > > &dest) const
 Append all objects with a specified role in subtree with this in root to vector dest.
 
std::vector< shared_ptr< const GeometryObject > > getObjectsWithRole (const std::string &role) const
 Get all objects with a specified role in subtree with this object as root.
 
virtual std::size_t getRealChildrenCount () const
 Get number of real (physically stored) children in geometry graph.
 
virtual shared_ptr< GeometryObjectgetRealChildNo (std::size_t child_no) const
 Get real (physically stored) child with given index.
 
virtual void removeAtUnsafe (std::size_t index)
 Remove child at given index.
 
void removeAt (std::size_t index)
 Remove child at given index.
 
void removeRangeUnsafe (std::size_t index_begin, std::size_t index_end)
 
bool removeRange (std::size_t index_begin, std::size_t index_end)
 Remove all children in given range [index_begin, index_end).
 
virtual void forEachRealObjectInSubtree (std::function< bool(const GeometryObject &)> callback) const
 Call a callback for each object in subtree with this in root.
 
FunctorIndexedIterator< ChildGetter > begin () const
 
FunctorIndexedIterator< ChildGetter > end () const
 
shared_ptr< GeometryObjectdeepCopy ()
 Get deep copy of this.
 
bool canHasAsChild (const GeometryObject &potential_child) const
 
bool canHasAsParent (const GeometryObject &potential_parent) const
 
void ensureCanHasAsParent (const GeometryObject &potential_parent) const
 Throw CyclicReferenceException if potential_parent is in subtree with this in root.
 
void ensureCanHaveAsChild (const GeometryObject &potential_child) const
 Throw CyclicReferenceException if potential_child has this in subtree.
 

Static Public Attributes

static const charNAME = "polygon"
 
- Static Public Attributes inherited from plask::GeometryObjectD< dim >
static const int DIM = dim
 

Protected Attributes

std::vector< Vec< 2 > > vertices
 
- Protected Attributes inherited from plask::GeometryObjectLeaf< 2 >
std::unique_ptr< MaterialProvider > materialProvider
 

Friends

shared_ptr< GeometryObjectreadPolygon (GeometryReader &reader)
 

Additional Inherited Members

- Static Public Member Functions inherited from plask::GeometryObject
static bool PredicateIsLeaf (const GeometryObject &el)
 Predicate which check if given object is leaf.
 
- Public Attributes inherited from plask::GeometryObject
unsigned max_steps
 Maximum number of points to split a single leaf.
 
double min_step_size
 Minimum distance between divisions for a single leaf.
 
std::set< std::string > roles
 Roles/tags.
 
boost::signals2::signal< void(Event &)> changed
 Changed signal, fired when object was changed.
 
- Protected Member Functions inherited from plask::GeometryObject
virtual void writeXMLChildren (XMLWriter::Element &dest_xml_object, WriteXMLCallback &write_cb, const AxisNames &axes) const
 Append all children of this to XML dest_xml_object.
 
void ensureIsValidChildNr (std::size_t child_no, const char *method_name="getChildNo", const char *arg_name="child_no") const
 Check if given index is valid child index and throw exception of it is not.
 
void ensureIsValidInsertPosition (std::size_t child_no, const char *method_name="insert", const char *arg_name="pos") const
 Check if given index is valid insert index and throw exception of it is not.
 
void fireChildrenChanged ()
 Inform observers that children list was changed (also that this is resized)
 
void fireChildrenRemoved (std::size_t beginIndex, std::size_t endIndex)
 
void fireChildrenInserted (std::size_t beginIndex, std::size_t endIndex)
 

Detailed Description

Definition at line 25 of file polygon.hpp.

Member Typedef Documentation

◆ BaseClass

◆ Box

Rectangle type in space on this, rectangle in space with dim number of dimensions.

Definition at line 38 of file polygon.hpp.

◆ DVec

Vector of doubles type in space on this, vector in space with dim number of dimensions.

Definition at line 35 of file polygon.hpp.

Constructor & Destructor Documentation

◆ Polygon() [1/8]

plask::Polygon::Polygon ( )
default

Construct an empty polygon.

◆ Polygon() [2/8]

plask::Polygon::Polygon ( const std::vector< Vec< 2 > > &  vertices,
const shared_ptr< Material > &  material = shared_ptr<Material>() 
)
explicit

Construct a polygon with vertices at specified points.

Parameters
verticescoordinates of the polygon vertices
materialmaterial of the constructed polygon

Definition at line 23 of file polygon.cpp.

◆ Polygon() [3/8]

plask::Polygon::Polygon ( std::vector< Vec< 2 > > &&  vertices,
const shared_ptr< Material > &&  material = shared_ptr<Material>() 
)
explicit

Construct a polygon with vertices at specified points.

Parameters
verticescoordinates of the polygon vertices
materialmaterial of the constructed polygon

Definition at line 26 of file polygon.cpp.

◆ Polygon() [4/8]

plask::Polygon::Polygon ( std::initializer_list< Vec< 2 > >  vertices,
const shared_ptr< Material > &  material = shared_ptr<Material>() 
)
explicit

Construct a polygon with vertices at specified points.

Parameters
verticescoordinates of the polygon vertices
materialmaterial of the constructed polygon

Definition at line 29 of file polygon.cpp.

◆ Polygon() [5/8]

plask::Polygon::Polygon ( const std::vector< Vec< 2 > > &  vertices,
shared_ptr< MaterialsDB::MixedCompositionFactory materialTopBottom 
)
explicit

Construct a polygon with vertices at specified points.

Parameters
verticescoordinates of the polygon vertices
materialTopBottommaterials of the constructed polygon

Definition at line 32 of file polygon.cpp.

◆ Polygon() [6/8]

plask::Polygon::Polygon ( std::vector< Vec< 2 > > &&  vertices,
shared_ptr< MaterialsDB::MixedCompositionFactory materialTopBottom 
)
explicit

Construct a polygon with vertices at specified points.

Parameters
verticescoordinates of the polygon vertices
materialTopBottommaterials of the constructed polygon

Definition at line 35 of file polygon.cpp.

◆ Polygon() [7/8]

plask::Polygon::Polygon ( std::initializer_list< Vec< 2 > >  vertices,
shared_ptr< MaterialsDB::MixedCompositionFactory materialTopBottom 
)
explicit

Construct a polygon with vertices at specified points.

Parameters
verticescoordinates of the polygon vertices
materialTopBottommaterials of the constructed polygon

Definition at line 38 of file polygon.cpp.

◆ Polygon() [8/8]

plask::Polygon::Polygon ( const Polygon src)
inlineexplicit

Copy-constructor.

Definition at line 94 of file polygon.hpp.

Member Function Documentation

◆ addLineSegmentsToSet()

void plask::Polygon::addLineSegmentsToSet ( std::set< typename GeometryObjectD< 2 >::LineSegment > &  segments,
unsigned  max_steps,
double  min_step_size 
) const
override

Definition at line 126 of file polygon.cpp.

◆ addPointsAlongToSet()

void plask::Polygon::addPointsAlongToSet ( std::set< double > &  points,
Primitive< 3 >::Direction  direction,
unsigned  max_steps,
double  min_step_size 
) const
override

Definition at line 108 of file polygon.cpp.

◆ addVertex()

void plask::Polygon::addVertex ( const Vec< 2 > &  vertex)
inline

Add a new vertex to the polygon.

Parameters
vertexnew vertex to insert

Definition at line 150 of file polygon.hpp.

◆ clearVertices()

void plask::Polygon::clearVertices ( )
inline

Clear all vertices from the polygon.

Definition at line 167 of file polygon.hpp.

◆ contains()

bool plask::Polygon::contains ( const DVec point) const
overridevirtual

Check if this geometry object contains point.

Parameters
pointpoint in local coordinates
Returns
true only if this geometry contains point p

Implements plask::GeometryObjectD< dim >.

Definition at line 94 of file polygon.cpp.

◆ getBoundingBox()

Polygon::Box plask::Polygon::getBoundingBox ( ) const
overridevirtual

Calculate minimal rectangle which contains all points of geometry object.

Returns
calculated rectangle

Implements plask::GeometryObjectD< dim >.

Definition at line 79 of file polygon.cpp.

◆ getTypeName()

std::string plask::Polygon::getTypeName ( ) const
overridevirtual

Get name of object type (like: "block2d", "shelf", "stack3d", etc.).

This name is used as tag name when object is serialized to XML.

Returns
name of object type

Implements plask::GeometryObject.

Definition at line 21 of file polygon.cpp.

◆ getVertex()

const Vec< 2 > & plask::Polygon::getVertex ( unsigned  index) const
inline

Get the vertex at specified index.

Parameters
indexindex of the vertex to get
Returns
vertex at specified index

Definition at line 183 of file polygon.hpp.

◆ getVertexCount()

unsigned plask::Polygon::getVertexCount ( ) const
inline

Get the number of vertices in the polygon.

Returns
number of vertices in the polygon

Definition at line 176 of file polygon.hpp.

◆ getVertices() [1/2]

std::vector< Vec< 2 > > & plask::Polygon::getVertices ( )
inline

Get the polygon vertices.

Returns
vector of polygon vertices

Definition at line 106 of file polygon.hpp.

◆ getVertices() [2/2]

const std::vector< Vec< 2 > > & plask::Polygon::getVertices ( ) const
inline

Get the polygon vertices.

Returns
vector of polygon vertices

Definition at line 100 of file polygon.hpp.

◆ insertVertex()

void plask::Polygon::insertVertex ( unsigned  index,
const Vec< 2 > &  vertex 
)
inline

Insert a new vertex to the polygon.

Parameters
indexindex in the vertex list where the new vertex should be inserted
vertexnew vertex to insert

Definition at line 141 of file polygon.hpp.

◆ removeVertex()

void plask::Polygon::removeVertex ( unsigned  index)
inline

Remove a vertex from the polygon.

Parameters
indexindex in the vertex list of the vertex to remove

Definition at line 159 of file polygon.hpp.

◆ setVertex()

void plask::Polygon::setVertex ( unsigned  index,
const Vec< 2 > &  vertex 
)
inline

Set one polygon vertex.

Parameters
indexindex of the vertex to set
vertexnew vertex to set

Definition at line 131 of file polygon.hpp.

◆ setVertices() [1/2]

void plask::Polygon::setVertices ( const std::vector< Vec< 2 > > &  vertices)
inline

Set the polygon vertices.

Returns
vector of polygon vertices

Definition at line 112 of file polygon.hpp.

◆ setVertices() [2/2]

void plask::Polygon::setVertices ( std::vector< Vec< 2 > > &&  vertices)
inline

Set the polygon vertices.

Returns
vector of polygon vertices

Definition at line 121 of file polygon.hpp.

◆ shallowCopy()

shared_ptr< GeometryObject > plask::Polygon::shallowCopy ( ) const
inlineoverridevirtual

Get shallow copy of this.

In the shallow copy all children are the same

Returns
shallow copy of this

Implements plask::GeometryObject.

Definition at line 194 of file polygon.hpp.

◆ validate()

void plask::Polygon::validate ( ) const
overridevirtual

Check if object is ready for calculation.

Throw exception if object is in bad state and can't be used in calculations, for example has not required children, etc. Default implementation do nothing, but inherited class can change this behavior.

Exceptions
Exceptionif object is not ready for calculation

Reimplemented from plask::GeometryObject.

Definition at line 41 of file polygon.cpp.

◆ writeXMLAttr()

void plask::Polygon::writeXMLAttr ( XMLWriter::Element dest_xml_object,
const AxisNames axes 
) const
overridevirtual

Append XML attributes of this to dest_xml_object.

By default do nothing.

Parameters
dest_xml_objectXML tag where attributes should be append
axeschosen name of axes

Reimplemented from plask::GeometryObject.

Definition at line 147 of file polygon.cpp.

Friends And Related Symbol Documentation

◆ readPolygon

shared_ptr< GeometryObject > readPolygon ( GeometryReader reader)
friend

Definition at line 161 of file polygon.cpp.

Member Data Documentation

◆ NAME

const char * plask::Polygon::NAME = "polygon"
static

Definition at line 40 of file polygon.hpp.

◆ vertices

std::vector<Vec<2> > plask::Polygon::vertices
protected

Definition at line 27 of file polygon.hpp.


The documentation for this struct was generated from the following files: