21 #define _USE_MATH_DEFINES
32 float len = length ();
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);
130 return direction * M_PI / 128.0 - M_PI;
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);
FCOORD nearest_pt_on_line(const FCOORD &line_point, const FCOORD &dir_vector) const
int direction(EDGEPT *point)
bool Serialize(FILE *fp) const
static double angle_from_direction(uinT8 direction)
bool DeSerialize(bool swap, FILE *fp)
float angle() const
find angle
uinT8 to_direction() const
ELISTIZE(ICOORDELT) bool FCOORD
void ReverseN(void *ptr, int num_bytes)
void from_direction(uinT8 direction)
int IntCastRounded(double x)
float sqlength() const
find sq length
static uinT8 binary_angle_plus_pi(double angle)
void set_with_shrink(int x, int y)
Set from the given x,y, shrinking the vector to fit if needed.
void setup_render(ICOORD *major_step, ICOORD *minor_step, int *major, int *minor) const