1
0
Fork 0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2025-09-06 00:10:15 +02:00

TEdgeSegment v1.

This commit is contained in:
oz 2020-11-21 18:14:40 +03:00
parent dbb69d8976
commit 0258363287
12 changed files with 340 additions and 2 deletions

View file

@ -1,5 +1,11 @@
#pragma once
struct vector_type
{
float X;
float Y;
};
struct __declspec(align(4)) rectangle_type
{
@ -9,10 +15,46 @@ struct __declspec(align(4)) rectangle_type
int Height;
};
struct circle_type
{
float X;
float Y;
float Unknown2;
float RadiusSq;
};
struct __declspec(align(4)) ray_type
{
vector_type Origin;
float Unknown2;
vector_type Direction;
float Unknown5;
float MaxDistance;
float Unknown7;
};
struct __declspec(align(4)) line_type
{
vector_type PerpendicularL;
float Unknown2;
vector_type Direction;
float Unknown5;
float PreComp1;
vector_type Origin;
float Unknown9;
float Unknown10;
float Unknown11;
};
class maths
{
public:
static void enclosing_box(rectangle_type* rect1, rectangle_type* rect2, rectangle_type* dstRect);
static int rectangle_clip(rectangle_type* rect1, rectangle_type* rect2, rectangle_type* dstRect);
static int overlapping_box(rectangle_type* rect1, rectangle_type* rect2, rectangle_type* dstRect);
static float ray_intersect_circle(ray_type* ray, circle_type* circle);
static float normalize_2d(vector_type* vec);
static void line_init(line_type* line, float x0, float y0, float x1, float y1);
static float ray_intersect_line(ray_type* ray, line_type* line);
};