ivutils
Loading...
Searching...
No Matches
region_2.h File Reference

Классы описывающие различные 2D или 3D геометрические тела. More...

#include <algorithm>
#include <vector>
#include "contour.h"
#include "basis_3.h"
#include "refobj.h"
#include "math_utils.h"
Include dependency graph for region_2.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  unknown_cat
 Generic category. More...
 
struct  polyhedron_cat
 Convex linear figure (3D polyhedron). More...
 
struct  sphere_cat
 Sphere. More...
 
class  Region< N >
 N-dimensional body. More...
 
class  Box_N< N >
 Regular n-dimensional parallelepiped with edges parallel to coordinate axis. More...
 
class  Box_N< N >::point_it
 iterator at 6 vertices of the box More...
 
class  Polygon_2
 polygon More...
 
class  Sphere_N< N >
 n-dimensional sphere More...
 
class  Circle
 circle, 2D sphere More...
 
class  StretchedRegion< reg_tt >
 Region obtained from region reg by shift and linear transformation specified by matrix basis. More...
 
class  CompositeRegion< N >
 union of arbitrary number of regions More...
 
class  RegionUnion< N >
 union of arbitrary number of regions More...
 
class  RegionIntersection< N >
 intersection of arbitrary number of regions More...
 

Macros

#define DUMP   GNUPLOT
 Specifies default visual dump format.
 

Typedefs

typedef Region< 3 > SpaceRegion
 Retained for compatibility with earlier versions.
 

Enumerations

enum  VISUAL_FORMATS { GNUPLOT = 0x1 , VTK = 0x2 }
 Bit flags to specify different visualization formats used in Region::CreateDumper() More...
 
enum  RegFlags {
  HAS_TESTPOINT =0x1 , HAS_TESTLINE =0x2 , HAS_TESTCONTOUR =0x4 , HAS_VOLUME =0x8 ,
  HAS_CLONE =0x10 , NOT_CONVEX =0x20 , HAS_NORMAL = 0x40 , IS_SMOOTH = 0x80 ,
  IS_INVERSE = 0x100
}
 Bit flags specifying the existing implementations of some Region<> functions, returned by Region::GetFlags(). More...
 

Functions

template<int N, class contour_t >
vec_type MonteCarloTestContour (const Region< N > *reg, const contour_t &cnt, Vector_Nt< vec_type, N > *subcenter=nullptr, int nt=1000)
 Returns the area fraction of the contour part that is inside the region reg, subcontour which is inside the region (if pointer is not nullptr) and the center of the subcontour (if pointer is not nullptr) by Monte Carlo method.
 
template<int N>
int MonteCarloTestLine (const Region< N > *reg, const Vector_Nt< vec_type, N > &p, const Vector_Nt< vec_type, N > &dir, vec_type *frac, Vector_Nt< vec_type, N > *surfp, Vector_Nt< vec_type, N > *surfn, vec_type length, int nt=1000)
 Records the fractions frac1 and frac2 of the interval (p,p+dir*length/dir.norm()) corresponding to the intersections surfpi=p+fraci*dir, surfni - coords of intersection and corresponding outer normal.
 
Polygon_2GetRegularPolygon (const Vector_2 &center, vec_type d, int n)
 

Detailed Description

Классы описывающие различные 2D или 3D геометрические тела.

Macro Definition Documentation

◆ DUMP

#define DUMP   GNUPLOT

Specifies default visual dump format.

Class RegDumper will be implemented correspondingly to this format.

Enumeration Type Documentation

◆ RegFlags

enum RegFlags

Bit flags specifying the existing implementations of some Region<> functions, returned by Region::GetFlags().


Enumerator
HAS_TESTPOINT 

TestPoint function is implemented for this region.

HAS_TESTLINE 

TestLine function (and also TestRay and TestEdge) is implemented for this region.

HAS_TESTCONTOUR 

TestContour function is implemented for this region.

HAS_VOLUME 

Volume function is implemented for this region.

HAS_CLONE 

Clone function is implemented for this region.

NOT_CONVEX 

Arbitrary shape which can not be decomposed into operations with convex regions.

HAS_NORMAL 

GetNormal() function is implemented.

IS_INVERSE 

The surface of the region is smooth.

◆ VISUAL_FORMATS

Bit flags to specify different visualization formats used in Region::CreateDumper()

Enumerator
GNUPLOT 

Dump files for gnuplot visualization.

VTK 

Dump files for VTK (Paraview) visualization.

Function Documentation

◆ GetRegularPolygon()

Polygon_2 * GetRegularPolygon ( const Vector_2 center,
vec_type  d,
int  n 
)
Returns
regular polygon, center is center, d is distance from center to vertex, n is number of vertices

◆ MonteCarloTestContour()

template<int N, class contour_t >
vec_type MonteCarloTestContour ( const Region< N > *  reg,
const contour_t &  cnt,
Vector_Nt< vec_type, N > *  subcenter = nullptr,
int  nt = 1000 
)

Returns the area fraction of the contour part that is inside the region reg, subcontour which is inside the region (if pointer is not nullptr) and the center of the subcontour (if pointer is not nullptr) by Monte Carlo method.

nt is number of random points used in Monte Carlo method.

◆ MonteCarloTestLine()

template<int N>
int MonteCarloTestLine ( const Region< N > *  reg,
const Vector_Nt< vec_type, N > &  p,
const Vector_Nt< vec_type, N > &  dir,
vec_type *  frac,
Vector_Nt< vec_type, N > *  surfp,
Vector_Nt< vec_type, N > *  surfn,
vec_type  length,
int  nt = 1000 
)

Records the fractions frac1 and frac2 of the interval (p,p+dir*length/dir.norm()) corresponding to the intersections surfpi=p+fraci*dir, surfni - coords of intersection and corresponding outer normal.

returns the number of intersections: 0, 1 or 2 (if there are more than 2 intersections, skip them). in calculations nt points at the interval (p, p+length*dir/dir.norm()) are checked if they are inside or outside the region