plane

package
v0.0.0-...-d322e89 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2018 License: BSD-2-Clause Imports: 2 Imported by: 1

Documentation

Overview

Package plane implements mathematical objects and operations in the plane.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(m Matrix, v coord.XYZ) coord.XYZ

Apply a tranformation matrix to a vector (i.e. returns matrix multiplied by column vector).

func Circumcenter

func Circumcenter(a, b, c coord.XY) coord.XY

Circumcenter returns the coordinates of the circumcenter of triangle a b c.

func InCircumcircle

func InCircumcircle(a, b, c coord.XY, p coord.XY) bool

InCircumcircle returns true if p is inside the circumcircle of triangle a b c (which must be in counter-clockwise order)

func InTriangle

func InTriangle(a, b, c coord.XY, p coord.XY) bool

InTriangle returns true if p is inside the triangle a b c.

func InTriangleCCW

func InTriangleCCW(a, b, c coord.XY, p coord.XY) bool

InTriangleCCW returns true if p is inside the triangle a b c (which must be in counter-clockwise order).

func IsCCW

func IsCCW(a, b, c coord.XY) bool

IsCCW returns true if a, b and c are in counter-clockwise order.

func Orientation

func Orientation(a, b, c coord.XY) float32

Orientation returns a psitive value if the triangle a b c is in counter-clockwise order, a negative value if it is in clockwise order, and a null value if a b and c are colinear.

Types

type GPUMatrix

type GPUMatrix [3][4]float32

GPUMatrix represents a transformation matrix with a memory layout compatible with the GPU.

type Matrix

type Matrix [3][3]float32

Matrix represents a transformation matrix.

Note: due to alignment rules, it's not possible to pass a Matrix directly to the GPU. You should convert it to a GPUMatrix first.

func Identity

func Identity() Matrix

Identity matrix.

func Rotation

func Rotation(angle float32) Matrix

Rotation by an angle.

func RotationAround

func RotationAround(angle float32, center coord.XY) Matrix

RotationAround a point.

func Scaling

func Scaling(s coord.XY) Matrix

Scaling and/or mirror along both axis.

func ScalingAround

func ScalingAround(s coord.XY, center coord.XY) Matrix

ScalingAround a point (and/or mirror).

func Shearing

func Shearing(s coord.XY) Matrix

Shearing along both axis.

func Translation

func Translation(t coord.XY) Matrix

Translation by a vector.

func Viewport

func Viewport(zoom, aspectRatio float32) Matrix

Viewport returns a transformation matrix that scale to an aspect ratio and zoom.

func (Matrix) GPU

func (m Matrix) GPU() GPUMatrix

GPU returns a GPUMatrix version of the matrix.

func (Matrix) Times

func (m Matrix) Times(o Matrix) Matrix

Times returns the matrix product with another transformation matrix.

func (Matrix) Translation

func (m Matrix) Translation() coord.XY

Translation returns the translation vector of the transformation matrix.

func (Matrix) Transpose

func (m Matrix) Transpose() Matrix

Transpose of the matrix.

func (Matrix) WithoutTranslation

func (m Matrix) WithoutTranslation() Matrix

WithoutTranslation returns the transformation matrix with the translation part removed.

Directories

Path Synopsis
Package quadedge provides a way to describe and manipulate the topology of planar maps (i.e., the topology of any closed polygonal mesh).
Package quadedge provides a way to describe and manipulate the topology of planar maps (i.e., the topology of any closed polygonal mesh).

Jump to

Keyboard shortcuts

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