Reference page for Surface
Contents
- Summary
- this = Surface(arguments) Constructor.
- this.add_curve(arguments) Add a curve to the surface boundary.
- this.add_hole(arguments) Add one or more holes to the surface.
- this.area(arguments) Return surface area(2D).
- this.fill(arguments) Fill(-plot) surface
- Surface.this.from_line(arguments) is a function.
- this.in_surface(arguments) Point in surface?
- Surface/this.is_ccw(arguments) is a function.
- this.plot(arguments) Plot surface.
- this.points(arguments) Surface boundary as an array of doubles.
- this.reduce(arguments) Reduce surface to the smallest possible area.
- this.reset_curves(arguments) Remove all lines.
Summary
SURFACE Class for representing elementary surfaces.
A Surface object represents a single surface with or without holes (i.e. a simply or multiply connected surface). Each surface is defined by
- (Optional) Its holes, each a Surface themselves.
See geometry creation for more details. Documentation for Surface doc Surface
PROPERTIES
- holes - Array of Surface objects inside this Surface.
- Surface/is_closed is a property.
- line_directions - Direction of each boundary segment (+1 / -1).
- lines - Array of Curve objects defining the boundary of the geometry. Ordered.
- name - Surface name.
METHODS
Class methods are listed below. Inherited methods are not included.
this = Surface(arguments) Constructor.
this = Surface(name)
Create an empty surface with the specified name (string).
this = Surface(name, (Curve definitions))
Create a surface, and then pass all following arguments (Curve definitions) to this.add_curve.
this.add_curve(arguments) Add a curve to the surface boundary.
add_curve(this, geo.line, p1, p1)
Add a line segment, from Point p1 to p2.
If the geometry already contains a Curve linking p1 and p2, it is automatically added to this. If not, a new Curve object is created.
Curves must be added in order, i.e. the start Point of the current curve must equal the end Point of the previously added Curve.
add_curve(this, geo.arc, p1, pcenter, p2)
Add a circle Arc, from Point p1 to p2, with its center at Point pcenter.
add_curve(this, Curve)
Add a Curve object to the boundary. TO BE IMPLEMENTED
add_curve(this, geo.hole, surf1, surf2, ..)
Adds the surfaces surf1, surf2, .. as holes within this surface.
Note: multiple calls to add_curve can be chained together by simply passing all arguments to the method at once. However, the holes, if any, must be supplied last and not be followed by any Curves.
this.add_hole(arguments) Add one or more holes to the surface.
add_hole(this, surface_1, ...)
this.area(arguments) Return surface area(2D).
Calculate the area of this surface (polygon). See this.points().
NOTE: after meshing the geometry, the area of the meshed surface may not exactly equal the number returned by area(this), especially if the surface contains Arc boundaries.
this.fill(arguments) Fill(-plot) surface
Surface.this.from_line(arguments) is a function.
this = from_line(l, direction)
this.in_surface(arguments) Point in surface?
bl = in_surface(this, X)
Surface/this.is_ccw(arguments) is a function.
is_ccw = is_ccw(this)
this.plot(arguments) Plot surface.
plot(this, args)
Plot surface with (args).
this.points(arguments) Surface boundary as an array of doubles.
X = points(this)
Returns the x- and y-coordinates of the Point objects defining the boundary of this surface.
this.reduce(arguments) Reduce surface to the smallest possible area.
This method removes such holes (geo.hole) that share one or more boundary Curves with this surface.
new_boundary_curves = reduce(this, [Point_start, Point_end] )
where Point_start and Point_end specify some boundary Line segment. The method modifies the boundary of this surface accordingly, and additionally returns the new boundary curves.
NOTE The method works on counterclockwise oriented surfaces, so the start and end points must be selected accordingly.