Kyopro Library
 
読み取り中…
検索中…
一致する文字列を見つけられません
Geometry 名前空間

幾何ライブラリ [詳解]

クラス

struct  Circle
 [詳解]
 
struct  Line
 直線 [詳解]
 
struct  Point
 2次元平面上の位置ベクトル [詳解]
 
struct  Segment
 線分 [詳解]
 

型定義

using Real = long double
 

列挙型

enum  Orientation {
  COUNTER_CLOCKWISE , CLOCKWISE , ONLINE_BACK , ONLINE_FRONT ,
  ON_SEGMENT
}
 

関数

bool almostEqual (Real a, Real b)
 
bool lessThan (Real a, Real b)
 
bool greaterThan (Real a, Real b)
 
bool lessThanOrEqual (Real a, Real b)
 
bool greaterThanOrEqual (Real a, Real b)
 
Orientation ccw (const Point &p0, const Point &p1, const Point &p2)
 3点 p0, p1, p2 の進行方向を返す
 
string orientationToString (Orientation o)
 
Point projection (const Point &p1, const Point &p2, const Point &p)
 ベクトル p の直線 p1, p2 への正射影ベクトルを返す
 
Point projection (const Line &l, const Point &p)
 ベクトル p の直線 l への正射影ベクトルを返す
 
Point reflection (const Point &p1, const Point &p2, const Point &p)
 ベクトル p の直線 p1, p2 に対する鏡像ベクトルを返す
 
Point reflection (const Line &l, const Point &p)
 ベクトル p の直線 l に対する鏡像ベクトルを返す
 
bool isParallel (const Line &l1, const Line &l2)
 
bool isOrthogonal (const Line &l1, const Line &l2)
 
bool isParallel (const Segment &l1, const Segment &l2)
 
bool isOrthogonal (const Segment &l1, const Segment &l2)
 
bool isParallel (const Line &l1, const Segment &l2)
 
bool isOrthogonal (const Line &l1, const Segment &l2)
 
bool isParallel (const Segment &l1, const Line &l2)
 
bool isOrthogonal (const Segment &l1, const Line &l2)
 
bool isPointOnLine (const Point &p, const Line &l)
 
bool isPointOnSegment (const Point &p, const Segment &s)
 
bool isIntersecting (const Segment &s1, const Segment &s2)
 
Point getIntersection (const Segment &s1, const Segment &s2)
 
Real distancePointToSegment (const Point &p, const Segment &s)
 
Real distanceSegmentToSegment (const Segment &s1, const Segment &s2)
 
Real getPolygonArea (const vector< Point > &points)
 
bool isConvex (const vector< Point > &points)
 
bool isPointOnPolygon (const vector< Point > &polygon, const Point &p)
 
bool isPointInsidePolygon (const vector< Point > &polygon, const Point &p)
 
vector< PointconvexHull (vector< Point > &points, bool include_collinear=false)
 
Real convexHullDiameter (const vector< Point > &hull)
 
vector< PointcutPolygon (const vector< Point > &g, const Line &l)
 
Real closestPair (vector< Point > &points, int l, int r)
 
int countIntersections (vector< Segment >segments)
 
int countCirclesIntersection (const Circle &c1, const Circle &c2)
 
Circle getInCircle (const Point &A, const Point &B, const Point &C)
 
Circle getCircumCircle (const Point &A, const Point &B, const Point &C)
 
vector< PointgetCircleLineIntersection (const Circle &c, Point p1, Point p2)
 
vector< PointgetCirclesIntersect (const Circle &c1, const Circle &c2)
 
vector< PointgetTangentLinesFromPoint (const Circle &c, const Point &p)
 
vector< SegmentgetCommonTangentsLine (const Circle &c1, const Circle &c2)
 

変数

const Real EPS =1e-9
 

詳解

幾何ライブラリ

型定義詳解

◆ Real

using Geometry::Real = long double

geo.hpp5 行目に定義があります。

列挙型詳解

◆ Orientation

列挙値
COUNTER_CLOCKWISE 
CLOCKWISE 
ONLINE_BACK 
ONLINE_FRONT 
ON_SEGMENT 

geo.hpp96 行目に定義があります。

関数詳解

◆ almostEqual()

bool Geometry::almostEqual ( Real a,
Real b )

geo.hpp8 行目に定義があります。

参照先 EPS.

◆ lessThan()

bool Geometry::lessThan ( Real a,
Real b )

geo.hpp9 行目に定義があります。

参照先 almostEqual().

◆ greaterThan()

bool Geometry::greaterThan ( Real a,
Real b )

geo.hpp10 行目に定義があります。

参照先 almostEqual().

◆ lessThanOrEqual()

bool Geometry::lessThanOrEqual ( Real a,
Real b )

geo.hpp11 行目に定義があります。

参照先 almostEqual().

◆ greaterThanOrEqual()

bool Geometry::greaterThanOrEqual ( Real a,
Real b )

geo.hpp12 行目に定義があります。

参照先 almostEqual().

◆ ccw()

Orientation Geometry::ccw ( const Point & p0,
const Point & p1,
const Point & p2 )

◆ orientationToString()

string Geometry::orientationToString ( Orientation o)

geo.hpp116 行目に定義があります。

参照先 CLOCKWISE, COUNTER_CLOCKWISE, ON_SEGMENT, ONLINE_BACK, ONLINE_FRONT.

◆ projection() [1/2]

Point Geometry::projection ( const Point & p1,
const Point & p2,
const Point & p )

ベクトル p の直線 p1, p2 への正射影ベクトルを返す

geo.hpp134 行目に定義があります。

参照先 Geometry::Point::dot(), Geometry::Point::norm(), Geometry::Point::operator*(), Geometry::Point::operator+(), Geometry::Point::operator-().

◆ projection() [2/2]

Point Geometry::projection ( const Line & l,
const Point & p )

ベクトル p の直線 l への正射影ベクトルを返す

geo.hpp141 行目に定義があります。

参照先 Geometry::Line::a, Geometry::Line::b, Geometry::Point::dot(), Geometry::Point::norm(), Geometry::Point::operator*(), Geometry::Point::operator+(), Geometry::Point::operator-().

◆ reflection() [1/2]

Point Geometry::reflection ( const Point & p1,
const Point & p2,
const Point & p )

ベクトル p の直線 p1, p2 に対する鏡像ベクトルを返す

geo.hpp148 行目に定義があります。

参照先 Geometry::Point::operator*(), Geometry::Point::operator-(), projection().

◆ reflection() [2/2]

Point Geometry::reflection ( const Line & l,
const Point & p )

ベクトル p の直線 l に対する鏡像ベクトルを返す

geo.hpp154 行目に定義があります。

参照先 Geometry::Point::operator*(), Geometry::Point::operator-(), projection().

◆ isParallel() [1/4]

bool Geometry::isParallel ( const Line & l1,
const Line & l2 )

◆ isOrthogonal() [1/4]

bool Geometry::isOrthogonal ( const Line & l1,
const Line & l2 )

◆ isParallel() [2/4]

bool Geometry::isParallel ( const Segment & l1,
const Segment & l2 )

◆ isOrthogonal() [2/4]

bool Geometry::isOrthogonal ( const Segment & l1,
const Segment & l2 )

◆ isParallel() [3/4]

bool Geometry::isParallel ( const Line & l1,
const Segment & l2 )

◆ isOrthogonal() [3/4]

bool Geometry::isOrthogonal ( const Line & l1,
const Segment & l2 )

◆ isParallel() [4/4]

bool Geometry::isParallel ( const Segment & l1,
const Line & l2 )

◆ isOrthogonal() [4/4]

bool Geometry::isOrthogonal ( const Segment & l1,
const Line & l2 )

◆ isPointOnLine()

bool Geometry::isPointOnLine ( const Point & p,
const Line & l )

◆ isPointOnSegment()

bool Geometry::isPointOnSegment ( const Point & p,
const Segment & s )

◆ isIntersecting()

bool Geometry::isIntersecting ( const Segment & s1,
const Segment & s2 )

◆ getIntersection()

◆ distancePointToSegment()

Real Geometry::distancePointToSegment ( const Point & p,
const Segment & s )

◆ distanceSegmentToSegment()

Real Geometry::distanceSegmentToSegment ( const Segment & s1,
const Segment & s2 )

geo.hpp212 行目に定義があります。

参照先 Geometry::Line::a, Geometry::Line::b, distancePointToSegment(), isIntersecting().

◆ getPolygonArea()

Real Geometry::getPolygonArea ( const vector< Point > & points)

geo.hpp221 行目に定義があります。

◆ isConvex()

bool Geometry::isConvex ( const vector< Point > & points)

geo.hpp231 行目に定義があります。

参照先 Geometry::Point::cross(), greaterThan(), lessThan().

◆ isPointOnPolygon()

bool Geometry::isPointOnPolygon ( const vector< Point > & polygon,
const Point & p )

geo.hpp245 行目に定義があります。

参照先 isPointOnSegment().

◆ isPointInsidePolygon()

bool Geometry::isPointInsidePolygon ( const vector< Point > & polygon,
const Point & p )

◆ convexHull()

vector< Point > Geometry::convexHull ( vector< Point > & points,
bool include_collinear = false )

geo.hpp269 行目に定義があります。

参照先 almostEqual(), CLOCKWISE, lessThan(), ONLINE_FRONT, Geometry::Point::x, Geometry::Point::y.

◆ convexHullDiameter()

Real Geometry::convexHullDiameter ( const vector< Point > & hull)

geo.hpp296 行目に定義があります。

参照先 Geometry::Point::abs().

◆ cutPolygon()

vector< Point > Geometry::cutPolygon ( const vector< Point > & g,
const Line & l )

◆ closestPair()

Real Geometry::closestPair ( vector< Point > & points,
int l,
int r )

geo.hpp338 行目に定義があります。

参照先 Geometry::Point::abs(), lessThan(), Geometry::Point::y.

◆ countIntersections()

int Geometry::countIntersections ( vector< Segment > segments)

geo.hpp363 行目に定義があります。

参照先 Geometry::Line::a, Geometry::Line::b, Geometry::Point::x.

◆ countCirclesIntersection()

int Geometry::countCirclesIntersection ( const Circle & c1,
const Circle & c2 )

◆ getInCircle()

Circle Geometry::getInCircle ( const Point & A,
const Point & B,
const Point & C )

◆ getCircumCircle()

Circle Geometry::getCircumCircle ( const Point & A,
const Point & B,
const Point & C )

◆ getCircleLineIntersection()

vector< Point > Geometry::getCircleLineIntersection ( const Circle & c,
Point p1,
Point p2 )

◆ getCirclesIntersect()

vector< Point > Geometry::getCirclesIntersect ( const Circle & c1,
const Circle & c2 )

◆ getTangentLinesFromPoint()

vector< Point > Geometry::getTangentLinesFromPoint ( const Circle & c,
const Point & p )

◆ getCommonTangentsLine()

vector< Segment > Geometry::getCommonTangentsLine ( const Circle & c1,
const Circle & c2 )

変数詳解

◆ EPS

const Real Geometry::EPS =1e-9

geo.hpp6 行目に定義があります。