PathEngine home  previous:  next: 
A helper method for building ground mesh around a set of 2D obstruction boundaries.
std::unique_ptr<iMesh> buildMeshAroundObstructionBoundaries(int32_t const * boundaries_Buffer, uint32_t boundaries_BufferEntries, bool optimise, int32_t optimisationThreshold_Numerator, int32_t optimisationThreshold_Denominator, const char *const* options) 
boundaries_Buffer, boundaries_BufferEntries 
(See  
optimise  Controls whether or not an edge optimisation step is applied to the triangulated boundaries.  
optimisationThreshold_Numerator 
The numerator of the optimisation threshold as an integer fraction. When optimise is set to true, the value passed here must be greater than or equal to 0, and less than or equal to 1000000.  
optimisationThreshold_Denominator 
The denominator of the optimisation threshold as an integer fraction. When optimise is set to true, the value passed here must be greater than 0, and less than or equal to 50000.  
options 
A set of named attributes to control exactly how the mesh result is created.

The first value in the boundary data specifies the number of boundaries being passed in. After that the number of points in each boundary should be supplied, following by coordinate data (x,y pairs) for each boundary point.
The boundaries must go clockwise around obstructed areas, and an 'external' boundary that encloses a finite unobstructed space is also required.
So, for example, the following boundary data includes a square external boundary
with one triangular obstruction, and generates a square mesh with a single triangular hole
and extents from 0 to 100 in both x and y.
const int32_t boundaryData[] = { 2, 4, 0,0, 100,0, 100,100, 0,100, 3, 40,40, 50,60, 60,40, }; 
This decomposes as:
Note that the points for the enclosing square go clockwise around the external obstructed area, but anticlockwise around the enclosed unobstructed area.
Boundaries do not need to be convex, but boundary lines should not touch or cross over each other, and the supplied coordinates must all be within the PathEngine coordinate range (1500000 to 1500000 inclusive).
Features such as obstructed areas with islands are supported, as well as other obstructed areas inside islands, and so on recursively, on the condition that boundary ordering is consistent for these kinds of features.
The method checks that the boundary data parses correctly, and also checks for some of the validation conditions, but these validation checks are not exhaustive and it is currently the responsibility of the caller to ensure that the boundary data is valid.
An optional mesh optimisation phase is included, similar to the mesh optimisation supported by the content processing.
The threshold for this optimisation phase is passed as an integer fraction, and then, as with the content processing, this specifies the maximum distance between removed vertices and the edge of the resulting optimised mesh.
The threshold distance is then specified as threshold distance = optimisationThreshold_Numerator / optimisationThreshold_Denominator, to enable precise values to be specified whilst avoiding potential issues related to floating point representations.
To convert numbers with decimal fractions to this format just use the relevant power of ten denominator, e.g. for a threshold distance of 1.25 set optimisationThreshold_Numerator to 125 and optimisationThreshold_Denominator to 100.
Or you can just choose some fixed precision, and convert floating point valies as follows:
int32_t denominator = 1000; int32_t numerator = static_cast<int32_t>(floatValue * 1000.f); 
Mesh buildMeshAroundObstructionBoundaries(int[] boundaries, bool optimise, int optimisationThreshold_Numerator, int optimisationThreshold_Denominator, string[] options); 
Mesh buildMeshAroundObstructionBoundaries(int[] boundaries, boolean optimise, int optimisationThreshold_Numerator, int optimisationThreshold_Denominator, String[] options); 
Documentation for PathEngine release 6.04  Copyright © 20022024 PathEngine  next: 