Electromagnetic Template Library (EMTL)
Loading...
Searching...
No Matches
Geometry

EMTL has two-dimensional bodies (a polygon and a circle) and a variety of convex three-dimensional bodies, which are described in more detail below.

The bodies must first be created from the corresponding classes, and then added to the grid by calling the addObject function of the uiExperiment class. Only the bodies added to the grid can be visualized. When adding a body to the grid, you need to specify whether the uiExperiment class itself should free up the memory allocated for the body (parameter 3 of the addObject function, 1 is necessary, 0 is not necessary) and you can specify its Level, by default equal to 0. Level is responsible for the priority of using one or another body during calculation. The higher the Level, the higher the priority. This is necessary in order to cut one body out of another or create a non-convex body. At the same time, there is a limitation: if the bodies intersect, then one body must completely lie on top of the other body. For a more detailed description and examples of the construction of non-convex objects, look below.

The coordinates of two-dimensional bodies are specified relative to some initial point of the 2D figure construction. The coordinates of three-dimensional bodies are specified immediately in the coordinates of the counting area.

When executing the BuildGeometry() function, EMTL generates files with the resulting geometry of the experiment (visualization), which can be viewed using gnuplot or paraview programs. For more information about visualization, see the relevant sections.

2D bodies

Polygon (Polygon_2) Polygon
Circle (Circle) Circle

3D bodies

There are several ways to create a convex three-dimensional object in EMTL - using simple primitives (sphere, rectangular parallelepiped), complex primitives (infinite cylinder and cone with an arbitrary two-dimensional shape at the base) and using polyhedra given an arbitrary number of planes.

Any primitive can be translated into a polyhedron or restricted to planes. Bodies consisting of polyhedra can be tilted or rotated.

At the same time, if the bodies go beyond the boundaries of the computational volume, then only the part of them that falls into it is considered.

Box (Box) Box
Sphere (Sphere) Sphere

Creating complex primitives

Complex primitives include an infinite cylinder and a cone with an arbitrary two-dimensional shape at the base (circle or polygon). They are class templates, the parameter of which is the class describing this 2D shape. (For example, Cylinder<Circle> is an infinite cylinder with a Circle base. Then the creation of such an object will look like this: Cylinder<Circle> cyl = Cylinder<Circle> (origin, n, x, y, &cir) where cir is an already created object of the Circle class)

The cylinder is described by a 3D coordinate in which the starting point of the 2D figure construction is placed and through which the plane in which this 2D figure lies passes, a 3D vector of the direction of the cylinder axis, 3D vectors that indicate the x and y axes for the 2D figure (and characterize the plane in which this 2D figure lies), and also the figure itself at the base. The cone is described in the same way, only the direction vector of the axis of the cone is also responsible for its height (the vertex of the cone).

Now there is a limitation, the direction of the 3D shape axis and the directions of the 3D x and y axes for 2D shapes must be mutually orthogonal.

To get a finite cylinder with a circle base, there is a ready-made global GetCylinder function. It is also possible to manually restrict an infinite cylinder to a set of planes by obtaining a new 3D object ConfinedRegion. Read about how to do this below. If you manually restrict an infinite cylinder to planes, you can get, for example, an inclined finite cylinder.

    Vector_3 origin (0,0,0), n (0,0,1), l (0,0,2), x (1,0,0), y (0,1,0); // Set various parameters
    double r = 2, h = 3;
    Circle cir (r, Vector_2(0,0) ); // Circle, with radius 2 and coordinates 0,0,0
    Cylinder<Circle> cyl(origin, n, x, y, &cir); Creating an infinite cylinder with a Circle base, the cylinder axis passes through the origin point and is directed along the Z axis. The x and y axes of the 2D plane in which the base (circle) lies are directed along the x and y axes of three-dimensional space
    Cone<Circle> con(origin, l, x, y, &cir); Creating an infinite cone is similar. The height of the cone will be equal to 2. Thus, the vertex of the cone will be located at the point 0,0,2
    ConfinedRegion<Cylinder<Circle> > * cyl2 = GetCylinder(origin, n, r, h); Create a finite cylinder with radius r=2, height h=3, with origin={0,0,0} and with an axis collinear to vector n={0,0,1}

Useful documentation: