Class Triangulation
- Namespace
- SpatialNET
- Assembly
- SpatialNET.Extensions.dll
A triangulated surface (ADR 0037, ADR 0038): vertices, triangles that know their neighbours, and what a terrain model needs from it: the triangle at a point, the height at a point, contour lines. It is made from points (the Delaunay triangulation), from points and lines that must be kept (a constrained Delaunay triangulation, for break lines), or from a polygon (the triangles inside it).
public sealed class TriangulationInheritance
Inherited Members
Remarks
The triangulation is immutable and thread-safe: any number of threads may ask it at the same time. Triangle t has the vertex ids
SpatialNET.Triangulation.Triangle(System.Int32) counter-clockwise; its side k (0, 1 or 2) is the edge from its vertex k to its vertex k + 1
(modulo 3), and SpatialNET.Triangulation.Neighbour(System.Int32,System.Int32) is the triangle on the other side of it, or −1 at the border.
The vertices carry the Z of the points they come from (M is not kept); SpatialNET.Triangulation.InterpolateZ(SpatialNET.Coordinate) and SpatialNET.Triangulation.Contour(System.Double,SpatialNET.IGeometryFactory) need Z. Equal triangulations are not guaranteed for points on a common circle: there are several equally Delaunay ones, and which one comes out is deterministic but not specified.
Properties
TriangleCount
The number of triangles; 0 if there were fewer than three different vertices or all of them are collinear.
public int TriangleCount { get; }Property Value
Vertices
The vertices; the ids used by SpatialNET.Triangulation.Triangle(System.Int32) are indices into this list.
public IReadOnlyList<Coordinate> Vertices { get; }Property Value
Methods
Aspect(int)
The aspect of a triangle: the compass direction that its plane faces, which is the direction of steepest descent, in degrees clockwise
from north (0 north, 90 east, 180 south, 270 west), in [0, 360) (ADR 0039).
public double Aspect(int triangle)Parameters
triangleint-
The triangle.
Returns
- double
-
The aspect in degrees; System.Double.NaN for a flat triangle (it faces nowhere) or if a vertex has no Z.
Exceptions
- ArgumentOutOfRangeException
-
triangleis out of range.
ConstrainedEdges(IGeometryFactory?)
The edges that are constraints (break lines, rings of the polygon), every edge once, as one path each.
public IPolyline2D ConstrainedEdges(IGeometryFactory? factory = null)Parameters
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- InvalidOperationException
-
No factory available.
Contour(double, IGeometryFactory?)
The contour line at a height (ADR 0037): where the surface, linear in every triangle, has the height z. A contour
is a polyline whose vertices have Z = z; it is closed (first = last) where it comes back to its start, and it
ends at the border of the triangulation. Pieces that meet in exactly one other piece are joined into one path.
public IPolyline2D Contour(double z, IGeometryFactory? factory = null)Parameters
zdouble-
The height; finite.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
- IPolyline2D
-
The contour; an empty polyline if the surface does not reach the height.
Remarks
A vertex whose height is exactly z counts as lying above the contour, so that the contour passes through it
and never splits there. Triangles with a vertex without Z are skipped, and a flat area at exactly z has no
contour. Where the contour of a neighbouring pair of triangles meets, it does so bit for bit.
Exceptions
- ArgumentOutOfRangeException
-
zisNaNor infinite. - InvalidOperationException
-
No factory available.
ContourBands(IReadOnlyList<double>, IGeometryFactory?)
The areas of the surface between heights (ADR 0042): the surface is cut along the contour lines of the given heights, and the pieces between two
of them are united to one polygon per band. Band 0 is everything below the first height, band i from height i − 1 up to (not
including) height i, and the last band everything from the last height up; so there is one more band than there are heights, and a band
without area is an empty polygon. The bands tile the surface, share their boundaries along the contour lines exactly, and the vertices on a
contour line have the height as Z. Triangles with a vertex without Z belong to no band.
public IReadOnlyList<IPolygon2D> ContourBands(IReadOnlyList<double> levels, IGeometryFactory? factory = null)Parameters
levelsIReadOnlyList<double>-
The heights, strictly ascending.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
- IReadOnlyList<IPolygon2D>
-
The polygons, one per band.
Remarks
Over a triangle the surface is a plane, so a band is a convex piece of it, and the cut points on an edge are computed from the two vertices of the edge in a fixed order: the two triangles that share the edge get the same point to the last bit, and the pieces fit without a gap and without an overlay. A triangle that is flat at exactly the height of a contour line belongs to the band above it.
Exceptions
- ArgumentNullException
-
levelsisnull. - ArgumentException
-
levelsare not finite or not strictly ascending. - InvalidOperationException
-
No factory available.
Drape(IPolyline2D, IGeometryFactory?)
Lays a polyline over the surface (ADR 0039): the same line in the map, with the height of the surface as Z and the distance along the input line as M. Wherever the line crosses an edge of the triangulation, or passes through a vertex, a vertex is inserted, so that the result follows the surface exactly: between two vertices the height is linear. Z needs a factory with SpatialNET.IGeometryFactory.SupportsZ, M one with SpatialNET.IGeometryFactory.SupportsM; what it does not support is dropped.
public IPolyline2D Drape(IPolyline2D line, IGeometryFactory? factory = null)Parameters
lineIPolyline2D-
The polyline.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
- IPolyline2D
-
The line over the surface; empty if no part of it is over the surface.
Remarks
M is the planar length along the input line with its paths laid end to end, as in SpatialNET.LinearReferencing, so
Interpolate, Project and the other methods of linear referencing apply to the result, and the height profile of a road
is its Z against its M. The 3D length is Length() of the planar line plus the climbing, which a caller computes from the vertices.
Parts of the line outside the triangulation, and parts over a triangle with a vertex without Z, are left out; the result then has several paths, one for every part that is inside. A line along an edge or through vertices is handled exactly; the decision whether a stretch is inside allows a tolerance of 1e-10 of the size of the surface. The cost is proportional to the triangles along the line (it is looked up in pieces of a few triangle sizes), so a long line over a large surface is cheap.
Exceptions
- ArgumentNullException
-
lineisnull. - InvalidOperationException
-
No factory available.
Edges(IGeometryFactory?)
The edges of the triangles, every edge once, as one path each, with the Z of their vertices.
public IPolyline2D Edges(IGeometryFactory? factory = null)Parameters
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- InvalidOperationException
-
No factory available.
FromPoints(IGeometry2D)
The Delaunay triangulation of the vertices of a geometry (as SpatialNET.Shapes.DelaunayTriangles(SpatialNET.IGeometry2D,SpatialNET.IGeometryFactory), ADR 0029): triangles such that no vertex lies inside the circumcircle of a triangle. They tile the convex hull of the vertices. Every vertex of every kind of geometry counts, with X and Y; vertices with the same X and Y count once (the first one with a Z gives it), and vertices that are not finite are ignored.
public static Triangulation FromPoints(IGeometry2D points)Parameters
pointsIGeometry2D-
The geometry whose vertices are triangulated.
Returns
- Triangulation
-
The triangulation; without triangles if there are fewer than three different vertices or all of them are collinear.
Exceptions
- ArgumentNullException
-
pointsisnull. - NotSupportedException
-
pointsis not a known geometry kind.
FromPointsAndLines(IGeometry2D, IGeometry2D, IGeometryFactory?, double?)
The constrained Delaunay triangulation (ADR 0038) of points and lines: a triangulation that contains every segment of the lines as a chain of edges (break lines, boundaries) and is Delaunay everywhere else. The vertices of the lines are vertices of the triangulation. The triangles tile the convex hull of all vertices.
public static Triangulation FromPointsAndLines(IGeometry2D points, IGeometry2D lines, IGeometryFactory? factory = null, double? gridSize = null)Parameters
pointsIGeometry2D-
The geometry whose vertices are points of the triangulation; may be empty.
linesIGeometry2D-
Polylines whose segments must be kept, or polygons whose rings must be; other kinds contribute their vertices only.
factoryIGeometryFactory?-
The factory used to node crossing constraints;
null= SpatialNET.GeometryFactory.Default, needed only if they cross. gridSizedouble?-
The grid for noding crossing constraints;
null= cascade (global default, otherwise automatic).
Returns
- Triangulation
-
The triangulation; without triangles if there are fewer than three different vertices or all of them are collinear.
Remarks
Constraints may touch, overlap and share end points, and a constraint that passes exactly through a vertex is split there. Where two constraints cross in a point that is an end of neither, they are first noded like in an overlay (ADR 0005): the crossing becomes a vertex, and all constraints are rounded to the grid, so their vertices can move by up to half of it. Without crossings the constraints are used exactly as they are.
Exceptions
- ArgumentNullException
-
An argument is
null. - NotSupportedException
-
A geometry is not a known geometry kind.
- ArgumentOutOfRangeException
-
gridSizeis not finite or not greater than 0. - InvalidOperationException
-
The constraints cross and there is no factory.
FromPolygon(IPolygon2D, IGeometryFactory?, double?)
The triangles inside a polygon (ADR 0038): its constrained Delaunay triangulation without anything outside the rings. The vertices
are the vertices of the polygon, and every edge of a ring is an edge of a triangle; holes are left out. A polygon without holes
and n vertices has n − 2 triangles, every hole adds two.
public static Triangulation FromPolygon(IPolygon2D polygon, IGeometryFactory? factory = null, double? gridSize = null)Parameters
polygonIPolygon2D-
The polygon.
factoryIGeometryFactory?-
The factory used to node crossing rings;
null= SpatialNET.GeometryFactory.Default, needed only if they cross. gridSizedouble?-
The grid for noding crossing rings;
null= cascade (global default, otherwise automatic).
Returns
- Triangulation
-
The triangulation.
Remarks
The inside is decided by the even-odd rule on the rings, so an invalid polygon is read the way MakeValid reads it. Rings that
cross are noded first, as for SpatialNET.Triangulation.FromPointsAndLines(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D,SpatialNET.IGeometryFactory,System.Nullable{System.Double}). A polygon with fewer than three different vertices or only collinear
ones has no triangles.
Exceptions
- ArgumentNullException
-
polygonisnull. - ArgumentOutOfRangeException
-
gridSizeis not finite or not greater than 0. - InvalidOperationException
-
The rings cross and there is no factory.
Gradient(int)
The gradient of a triangle: how much the height changes per unit in X and in Y, in the plane through its three vertices (ADR 0039). X, Y and Z are taken to be in the same unit.
public (double Dx, double Dy) Gradient(int triangle)Parameters
triangleint-
The triangle.
Returns
Exceptions
- ArgumentOutOfRangeException
-
triangleis out of range.
InterpolateNaturalNeighbour(Coordinate)
The height at a point by natural neighbour interpolation (Sibson, ADR 0041): the heights of the vertices that the point would be connected to if it were inserted, weighted by the area of their Voronoi cells that the new point takes over. The result is continuous, smooth between the vertices (except at the vertices themselves), reproduces a plane exactly, and never leaves the range of the heights around it, so it has none of the creases of the linear SpatialNET.Triangulation.InterpolateZ(SpatialNET.Coordinate) and no overshoots of a polynomial.
public double InterpolateNaturalNeighbour(Coordinate point)Parameters
pointCoordinate-
The point.
Returns
- double
-
The height; System.Double.NaN if the point lies outside every triangle or a vertex that takes part has no Z.
Remarks
It needs the Delaunay property, so for a triangulation with constraints (break lines, a polygon) it gives the linear SpatialNET.Triangulation.InterpolateZ(SpatialNET.Coordinate) instead, which is the right answer when the surface must have a crease. The same holds for a point on the border of the hull and for the rare case that the areas cannot be computed (a sliver triangle with a circumcentre beyond double precision). The cost is proportional to the number of vertices around the point (about six), so it is as fast as the linear one to within a small factor.
Exceptions
- ArgumentOutOfRangeException
-
The coordinates of
pointare not finite.
InterpolateZ(Coordinate)
The height at a point: Z interpolated linearly in the triangle that contains it (the plane through its three vertices). At a vertex it is the Z of the vertex, and on a surface that is a plane it is exact up to rounding.
public double InterpolateZ(Coordinate point)Parameters
pointCoordinate-
The point.
Returns
- double
-
The height; System.Double.NaN if the point lies outside every triangle or a vertex of its triangle has no Z.
Exceptions
- ArgumentOutOfRangeException
-
The coordinates of
pointare not finite.
IsConstrained(int, int)
Whether the edge of a side is a constraint (a break line, a ring of the polygon).
public bool IsConstrained(int triangle, int side)Parameters
Returns
Exceptions
- ArgumentOutOfRangeException
-
triangleorsideis out of range.
LineOfSight(Coordinate, Coordinate, double, double)
Whether one point can be seen from another over the surface (ADR 0041): the straight line from the eye, at the height of the surface plus
observerHeight, to the target, at the surface plus targetHeight, must not pass below the surface. The
surface is linear between the places where the line crosses an edge or a vertex, so it is enough to look there. A line that just touches the
surface (a ridge exactly in the way, flat ground at height 0) is not blocked. Where the line leaves the surface (a notch of a polygon) there
is no ground to block it.
public bool LineOfSight(Coordinate from, Coordinate to, double observerHeight = 0, double targetHeight = 0)Parameters
fromCoordinate-
The observer.
toCoordinate-
The target.
observerHeightdouble-
The height of the eye above the surface (a person: 1.7).
targetHeightdouble-
The height of the target above the surface.
Returns
- bool
-
trueif the line is free;falseif it is blocked, or if either point is outside the surface or has no height.
Exceptions
- ArgumentOutOfRangeException
-
The coordinates of a point or a height are not finite.
Locate(Coordinate)
The triangle that contains a point, on its border or inside. On a border shared by triangles it is the one with the smallest index. The decision is exact (the orientation test of the overlays, ADR 0005).
public int Locate(Coordinate point)Parameters
pointCoordinate-
The point.
Returns
- int
-
The triangle, or −1 if the point lies outside every triangle.
Exceptions
- ArgumentOutOfRangeException
-
The coordinates of
pointare not finite.
MinAngle(int)
The smallest angle of a triangle in degrees (ADR 0041): 60 for an equilateral triangle, near 0 for a sliver.
public double MinAngle(int triangle)Parameters
triangleint-
The triangle.
Returns
- double
-
The smallest angle, in degrees.
Exceptions
- ArgumentOutOfRangeException
-
triangleis out of range.
MinAngle()
The smallest angle of all triangles in degrees; System.Double.NaN for a triangulation without triangles.
public double MinAngle()Returns
Neighbour(int, int)
The triangle on the other side of the edge from vertex side to vertex side + 1 of a triangle.
public int Neighbour(int triangle, int side)Parameters
Returns
- int
-
The neighbour, or −1 where the triangle is at the border (the hull, or the edge of a polygon).
Exceptions
- ArgumentOutOfRangeException
-
triangleorsideis out of range.
Refine(double, double?, int)
A finer triangulation without sharp triangles (ADR 0041), by Delaunay refinement after Ruppert: points are added (the circumcentres of the
triangles that are too sharp or too large, and the middles of edges that would be encroached by them) until no angle is smaller than
minAngle and no triangle larger than maxArea. The shape of the surface is kept: the constraints
(break lines, the rings of a polygon) and the border stay where they are, only cut into shorter edges, and the added points get their
height from this surface, so they lie on it. A mesh for a finite element or flow calculation, or for a smoother contour map, starts here.
public Triangulation Refine(double minAngle = 20, double? maxArea = null, int maxSteinerPoints = 100000)Parameters
minAngledouble-
The smallest angle wanted, in degrees, from 0 (only the size counts) to 34; the default 20 is safe.
maxAreadouble?-
The largest area of a triangle in the plane, or
nullfor no limit. maxSteinerPointsint-
The most points that are added.
Returns
- Triangulation
-
The refined triangulation; the same instance if nothing had to be done.
Remarks
The method is guaranteed to stop for angles up to about 20.7 degrees, and in practice up to about 30, as long as the input has no angle
smaller than that between two constraints. Where it has (the tip of a thin wedge) the sharp triangles at the tip cannot be avoided, and
they are left as they are once their circumcircle is smaller than 1e-7 of the extent of the surface. maxSteinerPoints
ends the work in any case; the result then still is a valid triangulation, only not as fine as asked. A triangulation without triangles is
returned as it is.
Exceptions
- ArgumentOutOfRangeException
-
minAngleis not from 0 to 34,maxAreais not greater than 0, ormaxSteinerPointsis negative.
Resample(double, bool)
A smoother surface (ADR 0043): the heights of a regular grid of the given cell size are computed with SpatialNET.Triangulation.InterpolateNaturalNeighbour(SpatialNET.Coordinate), and the grid is triangulated again together with the border and the constraints (the vertices on the border and on break lines keep their heights, and the area that is covered is the same). The surface over the new triangles has no creases at the old edges and no peaks at the measurements, and SpatialNET.Triangulation.Contour(System.Double,SpatialNET.IGeometryFactory) and SpatialNET.Triangulation.ContourBands(System.Collections.Generic.IReadOnlyList{System.Double},SpatialNET.IGeometryFactory) of it are smooth, where those of the original follow its triangles.
public Triangulation Resample(double cellSize, bool keepVertices = false)Parameters
cellSizedouble-
The distance between the grid points; finite and greater than 0, and not so small that there would be more than five million of them.
keepVerticesbool-
trueto keep the inner vertices as well (the surface then passes through every measurement, with the point there).
Returns
- Triangulation
-
The finer triangulation; the same instance if there are no triangles or no grid point lies inside.
Remarks
The contour lines of any triangulation cannot cross each other, since over a triangle they are parallel straight lines, and this one is no exception, so smoothing the surface is the way to smooth contour lines that must not touch. Smoothing the lines afterwards (SpatialNET.Smoothing.Smooth(SpatialNET.IPolyline2D,System.Int32,SpatialNET.SmoothingMethod,SpatialNET.IGeometryFactory)) rounds the last corners, but cannot promise that.
The inner vertices (those that are not on the border or on a constraint) are not kept by default: the interpolated surface is smooth
everywhere but at the measurements themselves, where it has a point (an interpolation passes through its data), and that point would stay as a
kink in the contour lines. So the result is a smoothed surface that no longer passes exactly through the inner measurements, like a raster that
was interpolated from them (it passes through them to within the interpolation over one cell); keepVertices keeps them, for a
surface that must. Smooth is not the same as closer to the true terrain: natural neighbour interpolation of a curved surface is biased towards
the neighbours that surround a point, about as much as the linear interpolation is.
A cell size of about the mean distance between the vertices is a start, half of it gives a visibly smoother map. Grid points that lie on the border, on a constraint, or on a vertex are left out. Where the triangulation has constraints (break lines, a polygon) the heights between them are the linear ones, since natural neighbour interpolation does not cross a crease (SpatialNET.Triangulation.InterpolateNaturalNeighbour(SpatialNET.Coordinate)); the surface then is finer, but not smoother. Vertices without Z give points without Z.
Exceptions
- ArgumentOutOfRangeException
-
cellSizeis not finite or not greater than 0, or so small that the grid would be unreasonably large.
Slope(int)
The slope of a triangle in degrees: the angle of its plane to the horizontal, from 0 (flat) to 90 (vertical). X, Y and Z are taken to be in the same unit (ADR 0039).
public double Slope(int triangle)Parameters
triangleint-
The triangle.
Returns
- double
-
The slope in degrees; System.Double.NaN if a vertex has no Z.
Exceptions
- ArgumentOutOfRangeException
-
triangleis out of range.
SlopeZones(IReadOnlyList<double>, IGeometryFactory?)
The areas of the surface by slope class (ADR 0041): the triangles whose SpatialNET.Triangulation.Slope(System.Int32) lies between two limits are united to one polygon
per class. Class 0 is everything below the first limit, class i from limit i − 1 up to (not including) limit i, and the
last class everything from the last limit up; so there is one more class than there are limits, and a class without area is an empty polygon.
Triangles with a vertex without Z belong to no class.
public IReadOnlyList<IPolygon2D> SlopeZones(IReadOnlyList<double> limits, IGeometryFactory? factory = null)Parameters
limitsIReadOnlyList<double>-
The limits in degrees, strictly ascending.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
- IReadOnlyList<IPolygon2D>
-
The polygons, one per class.
Exceptions
- ArgumentNullException
-
limitsisnull. - ArgumentException
-
limitsare not finite or not strictly ascending. - InvalidOperationException
-
No factory available.
SurfaceArea(int)
The area of a triangle on the surface, in the plane through its three vertices: larger than its area in the map when it slopes (ADR 0039).
public double SurfaceArea(int triangle)Parameters
triangleint-
The triangle.
Returns
- double
-
The area; System.Double.NaN if a vertex has no Z.
Exceptions
- ArgumentOutOfRangeException
-
triangleis out of range.
SurfaceArea()
The area of the whole surface: the sum of SpatialNET.Triangulation.SurfaceArea(System.Int32) over all triangles. Triangles with a vertex without Z are not counted (ADR 0039).
public double SurfaceArea()Returns
- double
-
The area; 0 for a triangulation without triangles.
ToPolygons(IGeometryFactory?)
The triangles as polygons, counter-clockwise, in the order of their ids, with the Z of their vertices.
public IReadOnlyList<IPolygon2D> ToPolygons(IGeometryFactory? factory = null)Parameters
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
Exceptions
- InvalidOperationException
-
No factory available.
Triangle(int)
The vertex ids of a triangle, counter-clockwise.
public (int A, int B, int C) Triangle(int triangle)Parameters
triangleint-
The triangle, from 0 to SpatialNET.Triangulation.TriangleCount − 1.
Returns
Exceptions
- ArgumentOutOfRangeException
-
triangleis out of range.
Viewshed(Coordinate, double, double, double, int, IGeometryFactory?)
The part of the surface that can be seen from a point (ADR 0044): a polygon (or several) of everything within maxDistance of
the observer that a target at targetHeight above the ground can be seen at by an eye at observerHeight above the
ground at the observer. It is what SpatialNET.Triangulation.LineOfSight(SpatialNET.Coordinate,SpatialNET.Coordinate,System.Double,System.Double) asks for one target, asked for all of them: the line of sight to a point is free
where the ground along the line does not rise above it.
public IPolygon2D Viewshed(Coordinate observer, double maxDistance, double observerHeight = 0, double targetHeight = 0, int rays = 360, IGeometryFactory? factory = null)Parameters
observerCoordinate-
The place of the eye.
maxDistancedouble-
How far to look; finite and greater than 0.
observerHeightdouble-
The height of the eye above the ground (a person: 1.7).
targetHeightdouble-
The height of what is to be seen above the ground (0 for the ground itself).
raysint-
The number of rays, from 8 to 100,000.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default.
Returns
- IPolygon2D
-
The visible area; an empty polygon if nothing can be seen.
Remarks
A fan of rays rays leaves the observer at equal angles. Along every ray the surface is linear between the edges that the
ray crosses, and the horizon (the steepest slope from the eye to the ground so far) is followed exactly: the visible stretches of the ray come
out as exact intervals, not as a sample. The stretches of a ray stand for a slice of the angle around it, and the slices are united. So the
edge of the visible area is exact along the rays and approximate between them: at a distance r it is accurate to about
r · π / rays, so 360 rays give 1 % of the distance and 3600 give 0.1 %. A ridge that is narrower than a slice can slip through between two
rays.
A point outside the surface, or at a vertex without height, has nothing to see from; a stretch of a ray that leaves the surface (a notch of a
polygon) has no ground that can be seen, but does not block the view. The cost is that of rays lines over the surface
(SpatialNET.Triangulation.Drape(SpatialNET.IPolyline2D,SpatialNET.IGeometryFactory)) and the union of their slices, so it grows with the number of rays and with the distance, not with the size of the surface.
Exceptions
- ArgumentOutOfRangeException
-
The coordinates of
observer,maxDistanceor a height are not finite,maxDistanceis not greater than 0, orraysis not from 8 to 100,000. - InvalidOperationException
-
No factory available.
Volume(Triangulation)
The volume between this surface and another one (ADR 0041), over the area that both cover: Above is where this surface lies above the
other, Below where it lies below, both not negative; their difference is the net volume. With the ground before and after an excavation
Above is what is to be filled and Below what is to be cut away (or the other way round, as the surfaces are given). Both
surfaces are linear in their triangles, so the result is exact: the triangles are cut with each other, and the difference of two planes is
again a plane over every piece. Triangles with a vertex without Z are not counted. X, Y and Z are taken to be in the same unit.
public (double Above, double Below) Volume(Triangulation other)Parameters
otherTriangulation-
The other surface.
Returns
- (double Above, double Below)
-
The volume above and below it; (0, 0) if the surfaces have no area in common.
Exceptions
- ArgumentNullException
-
otherisnull.
Volume(double)
The volume between the surface and the horizontal plane at a height (ADR 0039): Above is what lies above the plane (to cut away),
Below what is missing up to it (to fill), both not negative. Their difference is the net volume. The surface is linear in every triangle,
so the result is exact; a triangle that the plane cuts is split along the cut. Triangles with a vertex without Z are not counted. X, Y and Z are
taken to be in the same unit, and the volume is in its cube.
public (double Above, double Below) Volume(double referenceZ)Parameters
referenceZdouble-
The height of the plane.
Returns
Exceptions
- ArgumentOutOfRangeException
-
referenceZisNaNor infinite.