21 #define _USE_MATH_DEFINES 34 if (len < 0.0000000001) {
46 int max_extent = std::max(abs(
x), abs(
y));
47 if (max_extent > INT16_MAX)
48 factor = max_extent / INT16_MAX + 1;
55 static int sign(
int x) {
86 int* major,
int* minor)
const {
116 xcoord = cos(radians);
117 ycoord = sin(radians);
136 const FCOORD& dir_vector)
const {
137 FCOORD point_vector(*
this - line_point);
142 double lambda = point_vector % dir_vector / dir_vector.
sqlength();
143 return line_point + (dir_vector * lambda);
bool Serialize(FILE *fp) const
void set_with_shrink(int x, int y)
Set from the given x,y, shrinking the vector to fit if needed.
bool normalise()
Convert to unit vec.
int16_t y() const
access_function
float angle() const
find angle
int direction(EDGEPT *point)
bool Serialize(FILE *fp, const char *data, size_t n)
void from_direction(uint8_t direction)
void setup_render(ICOORD *major_step, ICOORD *minor_step, int *major, int *minor) const
void ReverseN(void *ptr, int num_bytes)
static uint8_t binary_angle_plus_pi(double angle)
int16_t x() const
access function
float sqlength() const
find sq length
int IntCastRounded(double x)
static double angle_from_direction(uint8_t direction)
float length() const
find length
uint8_t to_direction() const
bool DeSerialize(FILE *fp, char *data, size_t n)
bool DeSerialize(bool swap, FILE *fp)
FCOORD nearest_pt_on_line(const FCOORD &line_point, const FCOORD &dir_vector) const
ELISTIZE(ICOORDELT) bool FCOORD