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