MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / ComputePoint

Method ComputePoint

Engine/lib/opcode/Ice/IceTriangle.cpp:250–266  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// * Computes a point on the triangle according to the stabbing information. * \param u,v [in] point's barycentric coordinates * \param pt [out] point on triangle * \param nearvtx [out] index of ne

Source from the content-addressed store, hash-verified

248 */
249///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
250void Triangle::ComputePoint(float u, float v, Point& pt, udword* nearvtx) const
251{
252 // Compute point coordinates
253 pt = (1.0f - u - v)*mVerts[0] + u*mVerts[1] + v*mVerts[2];
254
255 // Compute nearest vertex if needed
256 if(nearvtx)
257 {
258 // Compute distance vector
259 Point d(mVerts[0].SquareDistance(pt), // Distance^2 from vertex 0 to point on the face
260 mVerts[1].SquareDistance(pt), // Distance^2 from vertex 1 to point on the face
261 mVerts[2].SquareDistance(pt)); // Distance^2 from vertex 2 to point on the face
262
263 // Get smallest distance
264 *nearvtx = d.SmallestAxis();
265 }
266}
267
268void Triangle::Inflate(float fat_coeff, bool constant_border)
269{

Callers

nothing calls this directly

Calls 1

SquareDistanceMethod · 0.45

Tested by

no test coverage detected