This project is read-only.

How to set the color of some certain triangles in the triangulation result?

Aug 20, 2015 at 2:35 AM
Hi there,
First of all, I am very graceful for your project. It helps me a lot because nearly I am trying to use Delunay Triangulation to implement interest management in cooperative virtual environment. I need to get the adjecent triangles (not just neighbor) for each triangle within a certain "reachable" distance from its center. Now, I have implemented a Breadth-First traversal algorithm for the intent and get indexs of some triangles that may be adjecent. However, I am not sure if the traversal result is effective. I want to use some different colors to sign the adjecent triangles so that the traversal result can be intuitive displayed.
So, Could you tell me how to set the color of some triangles given index? Is there any readily available methods that the project provides ?any suggestions are welcome.
Aug 20, 2015 at 8:06 AM
Edited Aug 20, 2015 at 8:09 AM
You could use the render manager form the TriangleNet.Rendering namespace:
// Make sure triangle indices are numbered linearly.

// Create a mesh partition.
var partition = new int[mesh.Triangles.Count];

foreach (var t in mesh.Triangles)
    // Set the color index.
    partition[t.ID] = IsNeighbor(t) ? 1 : 0;

// Define the colors.
var colors = new Dictionary<int, Color>();
colors[0] = Color.Transparent;
colors[1] = Color.FromArgb(80, 0, 255, 0);
renderManager.Context.ColorManager.ColorDictionary = colors;

// Update the render manager to use the partition.
Aug 21, 2015 at 12:10 PM
Hi,I am sorry. I can't find the attribute “Contex” of "RenderManage". Are they the new features of the beta4? How can I use them in beta3? thanks
Aug 21, 2015 at 1:50 PM
Yes, it's beta4. The rendering stuff was rewritten completely, so I recommend switching to the new version if you want to use the new features.