add c and jai
This commit is contained in:
19
jai/modules/Console_Render/math_extras.jai
Normal file
19
jai/modules/Console_Render/math_extras.jai
Normal file
@@ -0,0 +1,19 @@
|
||||
get_triangle_centroid :: (t: Triangle) -> Vec2s64 {
|
||||
return get_triangle_centroid(t.p1, t.p2, t.p3);
|
||||
}
|
||||
|
||||
get_triangle_centroid :: (p1: Vec2s64, p2: Vec2s64, p3: Vec2s64) -> Vec2s64 {
|
||||
x := (p1.x + p2.x + p3.x) / 3;
|
||||
y := (p1.y + p2.y + p3.y) / 3;
|
||||
|
||||
return .{x, y};
|
||||
}
|
||||
|
||||
make_quad_from_rect :: (p1: Vec2s64, p2: Vec2s64) -> Quad {
|
||||
return .{
|
||||
.{ p1.x, p1.y },
|
||||
.{ p2.x, p1.y },
|
||||
.{ p2.x, p2.y },
|
||||
.{ p1.x, p2.y },
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user