tesseract
5.0.0-alpha-619-ge9db
|
Go to the documentation of this file.
19 #define _USE_MATH_DEFINES // for M_PI
32 if (len < 0.0000000001) {
44 int max_extent = std::max(abs(
x), abs(
y));
45 if (max_extent > INT16_MAX)
46 factor = max_extent / INT16_MAX + 1;
53 static int sign(
int x) {
84 int* major,
int* minor)
const {
114 xcoord = cos(radians);
115 ycoord = sin(radians);
127 return direction * M_PI / 128.0 - M_PI;
134 const FCOORD& dir_vector)
const {
135 FCOORD point_vector(*
this - line_point);
140 double lambda = point_vector % dir_vector / dir_vector.
sqlength();
141 return line_point + (dir_vector * lambda);
ELISTIZE(ICOORDELT) bool FCOORD
float angle() const
find angle
uint8_t to_direction() const
void from_direction(uint8_t direction)
bool DeSerialize(bool swap, FILE *fp)
int IntCastRounded(double x)
static double angle_from_direction(uint8_t direction)
int16_t x() const
access function
void setup_render(ICOORD *major_step, ICOORD *minor_step, int *major, int *minor) const
float length() const
find length
bool Serialize(FILE *fp) const
bool normalise()
Convert to unit vec.
FCOORD nearest_pt_on_line(const FCOORD &line_point, const FCOORD &dir_vector) const
static uint8_t 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.
float sqlength() const
find sq length
void ReverseN(void *ptr, int num_bytes)
bool DeSerialize(FILE *fp, char *data, size_t n=1)
bool Serialize(FILE *fp, const char *data, size_t n=1)
int16_t y() const
access_function