MeshModel Get Triangle Based on X,Y Coordinate

Need help in implementing some specific function to your LightningChart Ultimate powered application? Post a question and get code snippets from other LightningChart Ultimate community members.

Moderator: Arction_LasseP

Post Reply
SESruss
Posts: 22
Joined: Wed Mar 12, 2014 6:36 pm

MeshModel Get Triangle Based on X,Y Coordinate

Post by SESruss » Tue Nov 27, 2018 6:51 pm

I was looking at the 'Mesh models coloring, wireframe' demo and its mouse over annotation feature. I'd like to be able get the triangle based on X/Y values that sit inside one of the triangles that make up the mesh. Is this possible?

ArctionKestutis
Posts: 369
Joined: Mon Mar 14, 2016 9:22 am

Re: MeshModel Get Triangle Based on X,Y Coordinate

Post by ArctionKestutis » Wed Nov 28, 2018 3:49 pm

I believe User's Manual describe this in chapter 6.13.8 'Tracing the model with mouse'

MeshModel has triangle-based tracing for mouse position.
Use MouseTriangleTraced event. It will indicate the nearest triangle to camera, where the mouse hits.
The event arguments have the following info:
• IntersectionPointAxisValues: intersection point of triangle face, in axes values
• ModelSpaceTriangleCoordinates: array of 3 triangle corners (vertices) the mouse is hitting, in 3D model space coordinates
• WorldSpaceTriangleCoordinates: array of 3 triangle corners (vertices) the mouse is hitting, in 3D world space coordinates.
• NearestCoordinateIndex: Index of nearest coordinate index of traced triangle, value of 0…2. Use the index to extract the coordinate from ModelSpaceTriangleCoordinates or WorldSpaceTriangleCoordinates array.

Post Reply