CARVIEW |
Select Language
HTTP/2 200
date: Thu, 31 Jul 2025 12:03:12 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-robots-tag: none
etag: W/"6c7b411e7d6257dca60faf7ff0c92277"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com wss://alive-staging.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=QMW1CbbF4EB5JDesJlEm%2BQodi%2BtPm%2BE%2FDwoU6vYq39HcbK0eZJ0UywTiOxh7HAbyj%2BP5eB9vXzXbRV0GjqsIeM%2B9I3Ml3bv06ozFcuEH7B0UuBHKH10GITc7PECg5wSU7LZt4wV0ZATGiT8vGBVGyESh3D%2B4LEgg3wzp2XkqMwFDU22Kd6vE1gw4nwbJnjEP5Z4QLu0qgTzQz6SpaTy3ug6%2F7TG%2BmsG7VBaxL%2BYgqTdAAZvCt8CIADz%2BEEqnZCR2DeD25D3hWH98FGc92jpwAQ%3D%3D--S4iGPPmXizIOVgfn--rkEPbi2hjABJZn4NYXLEug%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1439054939.1753963392; Path=/; Domain=github.com; Expires=Fri, 31 Jul 2026 12:03:12 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Fri, 31 Jul 2026 12:03:12 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: C78A:1E1938:9B4172:B8D2E0:688B5B80
Triangulations 2D · Scrawk/CGALDotNet Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 46
Triangulations 2D
Justin edited this page Mar 13, 2022
·
7 revisions
CGAL provides a number of 2D triangulations that can be constructed incrementally. The types of triangulations are as follows.
A triangulation can be constructed as follows.
//Create the points for the triangulation.
var points = Point2d.RandomPoints(0, 10, new Box2f(-10, 10));
//Create the triangulation.
var tri = new Triangulation2<EIK>(points);
//Insert a point.
tri.Insert(new Point2d(1,1));
//Print some info about the triangulation.
tri.Print();
Elements of the triangulation can be recovered as follows.
//Get the points.
var points = new Point2d[tri.VertexCount];
tri.GetPoints(points, points.Length);
//Get the triangle indices where the index is a points index in trianglation.
var indices = new int[tri.TriangleCount];
tri.GetIndices(indices, indices.Length);
//Get the triangles a shapes.
var triangles = new Triangle2d[tri.TriangleCount];
tri.GetTriangles(triangles, triangles.Length);
The vertex and face objects can also be retrieved and contain more information.
var vertices = new TriVertex2[tri.VertexCount];
tri.GetVertices(vertices, vertices.Length);
var faces = new TriFace2[tri.TriangleCount];
tri.GetFaces(faces, faces.Length);
var face = faces[0];
Console.WriteLine("Face index = " +face.Index);
Console.WriteLine("Face first vertex index = " + face.GetVertexIndex(0));
Console.WriteLine("Face second vertex index = " + face.GetVertexIndex(1));
Console.WriteLine("Face third vertex index =" + face.GetVertexIndex(2));
var vertex = vertices[0];
Console.WriteLine("Vertex index = " + vertex.Index);
Console.WriteLine("Vertex point = " + vertex.Point);
Console.WriteLine("Vertex face index = " + vertex.FaceIndex);
Individual elements can be found with their index as follows.
if(tri.GetVertex(index, out TriVertex2 vertex))
{
//Vertex was found
}
The TriVertex2 and TriFace2 structs only refer to elements by their index in the triangulation. These indices can change if the triangulation changes. The data then becomes invalid and will need to be retrieved again. You can check if the triangulation has changed by the build stamp.
//Create the triangulation.
var tri = new Triangulation2<EIK>(points);
int buildStamp = tri.BuildStamp;
//Get the first vertex
TriVertex2 vertex;
tri.GetVertex(0, out vertex);
//Insert a new point.
tri.Insert(new Point2d(1,1));
if(buildStamp != tri.BuildStamp)
{
//Triangulation has changed so vertex data maybe invalid. Will need to retrieve again.
tri.GetVertex(0, out vertex);
buildStamp = tri.BuildStamp;
}
Below is a image a Delaunay triangulation and its Voronoi diagram.
;
Clone this wiki locally
You can’t perform that action at this time.