⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 line.h

📁 source code to compute the visibility polygon of a point in a polygon.
💻 H
字号:
/* Brian O'Connor *  * line.h: structures and functions for working with lines  * * IMPORTANT: all Points are assumed to be homogenous in this module.  */#include "input.h"#ifndef LINE_H#define LINE_Hclass Obstacle;class Cell;class Line {public:	Line(void) {};	Line(Point *p1, Point *p2);	Point *A; /* endpoints */	Point *B;	double length; /* used in computing intersections */	Obstacle *ob;	double a; /* line coordinates: a + bx + cy = 0 */	double b;	double c;};/* functions to encapsulate floating pt error */int FloatCompare(double m, double n);int FloatEqual(double m, double n);/* create a new line from 2 pts */Line *PointsToLine(Point *p1, Point *p2);Point *NewPoint(void);int PointCompare(Point *p1, Point *p2);int PointEqual(Point *p1, Point *p2);/* return TRUE if segments intersect w. intersection point returned in	result */int SegmentIntersection(Line *l1, Line *l2, Point *result);/* return TRUE if segment s intersects line l & also return int. point */int LineSegIntersection(Line *l, Line *s, Point *result);/* return Point where the given lines intersect in result */ void LineIntersection(Line *l1, Line *l2, Point *result);/* return Point where the given lines intersect in result, and    return the distance from l1->A endpoint to result (positive    direction is direction from A to B).  */void LineIntersectionDistance(Line *l1, Line *l2, Point *result, double *dist);/* returns the Distance from p1 to p2 */double LineDistance(Point *p1, Point *p2);/* returns TRUE if the given point is on the line segment, and false * if not. */int PointOnSegment(Line *l, Point *p);/* returns the angle made by the two lines. */double LineAngle(Line *l1, Line *l2);/* returns TRUE if the line segments overlap, and returns the endpoints * of the combined segment in pmin, pmax */int LinesOverlap(Line *l1, Line *l2, Point **pmin, Point **pmax);/* ASSERTs if the line is not valid (endpoints don't satisfy line eq) * and optionally can print out the Line structure. */ void VerifyLine(Line *l);void DotProductTest(void);#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -