21 #define _USE_MATH_DEFINES 34 if (len < 0.0000000001) {
46 int max_extent =
MAX(abs(
x), abs(
y));
55 static int sign(
int x) {
64 if (fwrite(&
xcoord,
sizeof(
xcoord), 1, fp) != 1)
return false;
65 if (fwrite(&
ycoord,
sizeof(
ycoord), 1, fp) != 1)
return false;
71 if (fread(&
xcoord,
sizeof(
xcoord), 1, fp) != 1)
return false;
72 if (fread(&
ycoord,
sizeof(
ycoord), 1, fp) != 1)
return false;
87 int* major,
int* minor)
const {
117 xcoord = cos(radians);
118 ycoord = sin(radians);
137 const FCOORD& dir_vector)
const {
138 FCOORD point_vector(*
this - line_point);
143 double lambda = point_vector % dir_vector / dir_vector.
sqlength();
144 return line_point + (dir_vector * lambda);
void from_direction(uinT8 direction)
static uinT8 binary_angle_plus_pi(double angle)
int IntCastRounded(double x)
FCOORD nearest_pt_on_line(const FCOORD &line_point, const FCOORD &dir_vector) const
bool Serialize(FILE *fp) const
void setup_render(ICOORD *major_step, ICOORD *minor_step, int *major, int *minor) const
void set_with_shrink(int x, int y)
Set from the given x,y, shrinking the vector to fit if needed.
float length() const
find length
ELISTIZE(ICOORDELT) bool FCOORD
inT16 x() const
access function
bool normalise()
Convert to unit vec.
uinT8 to_direction() const
int direction(EDGEPT *point)
static double angle_from_direction(uinT8 direction)
bool DeSerialize(bool swap, FILE *fp)
float sqlength() const
find sq length
void ReverseN(void *ptr, int num_bytes)
float angle() const
find angle
inT16 y() const
access_function