19 lines
461 B
Plaintext
19 lines
461 B
Plaintext
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 },
|
|
};
|
|
} |