triangle

package
v0.0.0-...-9c88ebf Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: BSD-3-Clause Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Transform

func Transform(a, b *Triangle) (d2.T, error)

Transform takes 2 triangles and returns a Transformation that when applied to the vertexes of A produces the vertex of B.

Types

type CouldNotResolveErr

type CouldNotResolveErr string

CouldNotResolveErr is returned if a TriangleTransform cannot resolve one of the axis.

func (CouldNotResolveErr) Error

func (c CouldNotResolveErr) Error() string

Error fulfils the error interface

type Triangle

type Triangle [3]d2.Pt

Triangle is a 2D triangle

func (*Triangle) Area

func (t *Triangle) Area() float64

Area of the triangle

func (*Triangle) BoundingBox

func (t *Triangle) BoundingBox() (d2.Pt, d2.Pt)

BoundingBox returns a bounding box that contains the triangle

func (*Triangle) Centroid

func (t *Triangle) Centroid() d2.Pt

Centroid returns the center of mass of the triangle

func (*Triangle) CircumCenter

func (t *Triangle) CircumCenter() d2.Pt

CircumCenter find the point where the bisectors of the sides intersect.

func (*Triangle) Contains

func (t *Triangle) Contains(pt d2.Pt) bool

Contains checks if a point is inside the triangle.

func (*Triangle) ConvexHull

func (t *Triangle) ConvexHull() []d2.Pt

ConvexHull fulfills shape.ConvexHuller. It returns the triangle as a slice.

func (*Triangle) L

func (t *Triangle) L(ts, c int) d2.Limit

L fulfills Limiter and describes the parametric methods on the triangle.

func (*Triangle) LineIntersections

func (t *Triangle) LineIntersections(l line.Line, buf []float64) []float64

LineIntersections find the intersections of the given line with the triangle relative to the line

func (*Triangle) Perimeter

func (t *Triangle) Perimeter() float64

Perimeter of the triangle

func (*Triangle) Pt1

func (t *Triangle) Pt1(t0 float64) d2.Pt

Pt1 returns a point along the perimeter is t0 is between 0 and 1.

func (*Triangle) Pt1c0

func (t *Triangle) Pt1c0() d2.Pt1

Pt1c0 converts the triangle to line.Segments

func (*Triangle) Pt2

func (t *Triangle) Pt2(t0, t1 float64) d2.Pt

Pt2 finds a point inside the triange if t0 and t1 are both between 0 and 1 inclusive. Conforms to shape filling rules.

func (*Triangle) Pt2c1

func (t *Triangle) Pt2c1(t0 float64) d2.Pt1

Pt2c1 finds the fill line for t0.

func (*Triangle) SignedArea

func (t *Triangle) SignedArea() float64

SignedArea of the triangle

func (*Triangle) String

func (t *Triangle) String() string

String fulfills Stringer

Jump to

Keyboard shortcuts

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