geometry

package
v0.0.0-...-23e9799 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	G_EPS = 1e-10
	G_PI  = math.Pi

	G_ONLINE_FRONT      = -2
	G_CLOCKWISE         = -1
	G_ON_SEGMENT        = 0
	G_COUNTER_CLOCKWISE = 1
	G_ONLINE_BACK       = 2

	G_OUT = 0
	G_ON  = 1
	G_IN  = 2
)

Variables

This section is empty.

Functions

func Angle

func Angle(a, b, c Point) float64

余弦定理でa-b-cの角度のうち小さい方を返す

func AreaPolygonCircle

func AreaPolygonCircle(P []Point, c Circle) float64

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_H 円と多角形の共通部分の面積

func Arg

func Arg(p Point) float64

func Contains

func Contains(P []Point, q Point) int

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_C 多角形と点の包含判定

func ConvexDiameter

func ConvexDiameter(P []Point) (maxDist float64, mi, mj int)

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_B 凸多角形の直径(最遠頂点対間距離)

func Cross

func Cross(p, q Point) float64

func DegreeToRadian

func DegreeToRadian(d float64) float64

func DistanceLineLine

func DistanceLineLine(l, m Line) float64

func DistanceLinePoint

func DistanceLinePoint(l Line, p Point) float64

func DistanceLineSegment

func DistanceLineSegment(l Line, s Segment) float64

func DistancePointPoint

func DistancePointPoint(a, b Point) float64

func DistanceSegmentPoint

func DistanceSegmentPoint(s Segment, p Point) float64

func Dot

func Dot(p, q Point) float64

func IsIntersectCircleLine

func IsIntersectCircleLine(c Circle, l Line) bool

func IsIntersectCirclePoint

func IsIntersectCirclePoint(c Circle, p Point) bool

func IsIntersectCircleSegment

func IsIntersectCircleSegment(c Circle, s Segment) int

func IsIntersectLineLine

func IsIntersectLineLine(l, m Line) bool

func IsIntersectLinePoint

func IsIntersectLinePoint(l Line, p Point) bool

交差判定

func IsIntersectLineSegment

func IsIntersectLineSegment(l Line, s Segment) bool

func IsIntersectSegmentPoint

func IsIntersectSegmentPoint(s Segment, p Point) bool

func RadianToDegree

func RadianToDegree(r float64) float64

Types

type Circle

type Circle struct {
	// contains filtered or unexported fields
}

func IncircleOfTriangle

func IncircleOfTriangle(a, b, c Point) Circle
	return NewCircle(NewPoint(p.x, p.y), r)
}

内接円 http://prognote.web.fc2.com/win_c_cpp/tri_incircle/index.html

func NewCircle

func NewCircle(p Point, r float64) Circle

type Line

type Line struct {
	// contains filtered or unexported fields
}

func NewLine

func NewLine(a, b Point) Line

func TangentCircleCircle

func TangentCircleCircle(c1, c2 Circle) []Line

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_G 円 c1, c2 の共通接線

func VerticalBisector

func VerticalBisector(a, b Point) Line

垂直二等分線

type Point

type Point struct {
	// contains filtered or unexported fields
}

func Conj

func Conj(p Point) Point

func ConvexCut

func ConvexCut(U []Point, l Line) []Point

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_C 凸多角形の切断 直線 l.a-l.b で切断しその左側にできる凸多角形を返す

func CrossPointLineLine

func CrossPointLineLine(l, m Line) Point

func CrossPointsCircleSegment

func CrossPointsCircleSegment(c Circle, l Segment) [2]Point

func NewPoint

func NewPoint(x, y float64) Point

func ProjectionToLine

func ProjectionToLine(l Line, p Point) Point

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_A 射影 直線 l に p から垂線を引いた交点を求める

func ProjectionToSegment

func ProjectionToSegment(l Segment, p Point) Point

func Reflection

func Reflection(l Line, p Point) Point

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_B 反射 直線 l を対称軸として点 p と線対称にある点を求める

func Rotate90

func Rotate90(p Point) Point

func RotateTheta

func RotateTheta(t float64, p Point) Point

func TangentCirclePoint

func TangentCirclePoint(c1 Circle, p2 Point) [2]Point

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_F 点 p を通る円 c の接線

func (Point) Add

func (p Point) Add(q Point) Point

func (Point) Cross

func (p Point) Cross(q Point) float64

func (Point) Dot

func (p Point) Dot(q Point) float64

func (Point) Minus

func (p Point) Minus(q Point) Point

func (Point) Mul

func (p Point) Mul(a float64) Point

func (Point) Norm

func (p Point) Norm() float64

func (Point) Norm2

func (p Point) Norm2() float64

type Segment

type Segment struct {
	// contains filtered or unexported fields
}

func NewSegment

func NewSegment(a, b Point) Segment

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL