This module contains some functions, data and classes for generating Formex structures representing simple geometric shapes. You need to import this module in your scripts to have access to its contents.
name) |
This is a convenience function returning a plex-2 Formex constructed from one of the patterns defined in the simple.Pattern dictionary. Currently, the following pattern names are defined: 'line', 'angle', 'square', 'plus', 'cross', 'diamond', 'rtriangle', 'cube', 'star', 'star3d'. See the Pattern example.
x0,x1,nx) |
x0 and x1 are n-dimensional points (usually 1D, 2D or 3D). The space between x0 and x1 is divided in nx equal parts. nx should have the same dimension as x0 and x1. The result is a rectangular grid of coordinates in an array with shape ( nx[0]+1, nx[1]+1, ..., n ).
x=0.,y=0.,z=0.) |
Each of the coordinates can be specified and is zero by default.
p1=[0.,0.,0.],p2=[1.,0.,0.],n=1) |
p1: first point, p2: second point The line is split up in n segments.
nx,ny,b=None,h=None,bias=0.,diag=None) |
This is a convenience function to create a rectangle with given size. The default b/h values are equal to nx/ny, resulting in a modular grid. The rectangle lies in the (x,y) plane, with one corner at [0,0,0]. By default, the elements are quads. By setting diag='u','d' of 'x', diagonals are added in /, resp. and both directions, to form triangles.
a1=2.,a2=0.,a3=360.) |
All points generated by this function lie on a circle with unit radius at the origin in the x-y-plane.
a1 (the dash angle) is the angle enclosed between the start and
end points of each line segment.
a2 (the module angle) is the angle enclosed between the start
points of two subsequent line segments.
If a2==0.0 is given, it will be taken equal to a1.
a3 (the arc angle) is the total angle enclosed between the first
point of the first segment and the end point of the last segment.
All angles are given in degrees and are measured in the direction from x- to y-axis. The first point of the first segment is always on the x-axis.
The default values produce a full circle (approximately).
If
, the result is an arc.
Large values of a1 and a2 result in polygones. Thus
circle(120.) is an equilateral triangle and circle(60.) is regular hexagone.
Remark that the default a2 == a1 produces a continuous line, while a2 > a1 results in a dashed line.
n) |
Creates the circumference of a regular polygon with sides,
inscribed in a circle with radius 1 and center at the origin.
The first point lies on the axis 0. All points are in the (0,1) plane.
The return value is a plex-2 Formex.
This function is equivalent to circle(360./n).
) |
Returns an equilateral triangle with side length 1. The first point is the origin, the second points is on the axis 0. The return value is a plex-3 Formex.
x=None,n=8) |
x is a (3,3) shaped array of coordinates, specifying 3 points.
Return an array with 2*n+1 points lying on the quadratic curve through the points x. Each of the intervals [x0,x1] and [x1,x2] will be divided in n segments.
nx,ny,r=1,bot=-90,top=90) |
A sphere with radius r is modeled by a regular grid of nx longitude circles, ny latitude circles and their diagonals.
The 3 sets of lines can be distinguished by their property number: 1: diagonals, 2: meridionals, 3: horizontals.
The sphere caps can be cut off by specifying top and bottom latitude angles (measured in degrees from 0 at north pole to 180 at south pole.
nx,ny,r=1,bot=-90,top=90) |
A sphere with radius r is modeled by the triangles fromed by a regular grid of nx longitude circles, ny latitude circles and their diagonals.
The two sets of triangles can be distinguished by their property number: 1: horizontal at the bottom, 2: horizontal at the top.
The sphere caps can be cut off by specifying top and bottom latitude angles (measured in degrees from 0 at north pole to 180 at south pole.
curve1,curve2,n) |
curve1, curve2 are plex-2 Formices with the same number of elements. The two curves are connected by a surface of quadrilaterals, with n elements in the direction between the curves.
r,t,nr,nt,h=0.,diag=None) |
A sector with radius r and angle t is modeled by dividing the radius in nr parts and the angle in nt parts and then drawing straight line segments. If a nonzero value of h is given, a conical surface results with its top at the origin and the base circle of the cone at z=h. The default is for all points to be in the (x,y) plane.
By default, a plex-4 Formex results. The central quads will collapse into triangles. If diag='up' or diag = 'down', all quads are divided by an up directed diagonal and a plex-3 Formex results.