14 lines
406 B
C#
14 lines
406 B
C#
public class MathHelpers
|
|
{
|
|
public static float Edge(float2 a, float2 b, float2 c)
|
|
{
|
|
return (c.x - a.x) * (b.y - a.y) - (c.y - a.y) * (b.x - a.x);
|
|
}
|
|
|
|
public static float2 NDCToScreen(float2 ndc, int width, int height)
|
|
{
|
|
float x = (ndc.x + 1f) * 0.5f * width;
|
|
float y = (1f - (ndc.y + 1f) * 0.5f) * height; // flip Y
|
|
return new float2(x, y);
|
|
}
|
|
} |