geometry

package
v0.0.0-...-e43e367 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Eps = 1e-6

Functions

func Det

func Det(a, b, c, d float64) float64

func GetTanAngle

func GetTanAngle(l1 *Line, l2 *Line) float64

func Inside

func Inside(v, min, max float64) bool

Types

type Line

type Line struct {
	Start, End *Vector
	A, B, C    float64
}

func FindCutLine

func FindCutLine(square float64, res *Polygons) (*Line, bool)

func GetBisector

func GetBisector(l1 *Line, l2 *Line) *Line

func GetCut

func GetCut(l1 *Line, l2 *Line, s float64, poly1 *Polygon, poly2 *Polygon) (*Line, bool)

func NewDirectedLine

func NewDirectedLine(p *Vector, d *Vector) *Line

func NewEmptyLine

func NewEmptyLine() *Line

func NewLineByValues

func NewLineByValues(a, b, c float64) *Line

func NewLineByVector

func NewLineByVector(start, end *Vector) *Line

func (*Line) CrossLineLine

func (l *Line) CrossLineLine(line *Line) (*Vector, bool)

func (*Line) CrossLineSegment

func (l *Line) CrossLineSegment(line *Line) (*Vector, bool)

func (*Line) CrossSegmentSegment

func (l *Line) CrossSegmentSegment(line *Line) (*Vector, bool)

func (*Line) GetDistance

func (l *Line) GetDistance(point *Vector) float64

func (*Line) GetLineNearestPoint

func (l *Line) GetLineNearestPoint(point *Vector) *Vector

func (*Line) GetPointAlong

func (l *Line) GetPointAlong(t float64) *Vector

func (*Line) GetSegmentNearestPoint

func (l *Line) GetSegmentNearestPoint(point *Vector) *Vector

func (*Line) Length

func (l *Line) Length() float64

func (*Line) PointSide

func (l *Line) PointSide(point *Vector) int

func (*Line) Reverse

func (l *Line) Reverse() *Line

func (*Line) SquareLength

func (l *Line) SquareLength() float64

type Polygon

type Polygon struct {
	Poly Vectors
}

func NewEmptyPolygon

func NewEmptyPolygon() *Polygon

func NewPolygon

func NewPolygon(vectors Vectors) *Polygon

func (*Polygon) Add

func (p *Polygon) Add(vector *Vector)

func (*Polygon) Clear

func (p *Polygon) Clear()

func (*Polygon) CountCenter

func (p *Polygon) CountCenter() *Vector

func (*Polygon) CountSquare

func (p *Polygon) CountSquare() float64

func (*Polygon) CreateSubPoly

func (p *Polygon) CreateSubPoly(line1 int, line2 int) (*Polygon, *Polygon)

func (*Polygon) Empty

func (p *Polygon) Empty() bool

func (*Polygon) FindDistance

func (p *Polygon) FindDistance(point *Vector) float64

func (*Polygon) FindNearestPoint

func (p *Polygon) FindNearestPoint(point *Vector) *Vector

func (*Polygon) IsClockwise

func (p *Polygon) IsClockwise() bool

func (*Polygon) IsPointInside

func (p *Polygon) IsPointInside(point *Vector) bool

func (*Polygon) IsSegmentInsidePoly

func (p *Polygon) IsSegmentInsidePoly(l *Line, excludeLine1 int, excludeLine2 int) bool

func (*Polygon) Length

func (p *Polygon) Length() int

func (*Polygon) Split

func (p *Polygon) Split(square float64) (*Polygon, *Polygon, *Line, bool)

func (*Polygon) SplitNearestEdge

func (p *Polygon) SplitNearestEdge(point *Vector)

func (*Polygon) ToLatLng

func (p *Polygon) ToLatLng(divider float64) []s2.LatLng

func (*Polygon) ToPoints

func (p *Polygon) ToPoints() []s2.Point

func (*Polygon) Vector

func (p *Polygon) Vector(i int) *Vector

type Polygons

type Polygons struct {
	Bisector *Line

	LeftTriangle  *Polygon
	Trapezoid     *Polygon
	RightTriangle *Polygon

	P1Exist bool
	P2Exist bool
	P3Exist bool
	P4Exist bool

	LeftTriangleSquare  float64
	TrapezoidSquare     float64
	RightTriangleSquare float64
	TotalSquare         float64
}

func NewEmptyPolygons

func NewEmptyPolygons() *Polygons

func NewPolygonsFromLine

func NewPolygonsFromLine(l1 *Line, l2 *Line) *Polygons

type Vector

type Vector struct {
	r3.Vector
}

func NewVector

func NewVector(x, y, z float64) *Vector

NewVector - creates new vector from absolut points

func NewVectorByGeo

func NewVectorByGeo(vector r3.Vector) *Vector

NewVectorByGeo - creates a new vector by providing the underlying object

func (*Vector) Add

func (v *Vector) Add(vector *Vector) *Vector

func (*Vector) Div

func (v *Vector) Div(vector *Vector) *Vector

func (*Vector) DivConstant

func (v *Vector) DivConstant(value float64) *Vector

func (*Vector) Dot

func (v *Vector) Dot(vector *Vector) float64

func (*Vector) Equal

func (v *Vector) Equal(vector *Vector) bool

func (*Vector) Length

func (v *Vector) Length() float64

func (*Vector) Mul

func (v *Vector) Mul(vector *Vector) *Vector

func (*Vector) MulConstant

func (v *Vector) MulConstant(value float64) *Vector

func (*Vector) Norm

func (v *Vector) Norm() *Vector

func (*Vector) SquareLength

func (v *Vector) SquareLength() float64

func (*Vector) Sub

func (v *Vector) Sub(vector *Vector) *Vector

type Vectors

type Vectors []*Vector

func (*Vectors) Add

func (v *Vectors) Add(vector *Vector)

func (*Vectors) Insert

func (v *Vectors) Insert(vector *Vector, index int)

func (*Vectors) Length

func (v *Vectors) Length() int

func (*Vectors) Reserve

func (v *Vectors) Reserve()

func (*Vectors) Vector

func (v *Vectors) Vector(i int) *Vector

Jump to

Keyboard shortcuts

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