graphics

package
v0.0.0-...-ba5fac2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Sort these alphabetically or vollick will hunt you down.
	DRAW_OP_COLOR = iota
	DRAW_OP_QUADS
)

Variables

This section is empty.

Functions

func CheckForGLErrors

func CheckForGLErrors()

func Cos2Atan

func Cos2Atan(d float32) float32

Returns cos(2 * atan(d))

func CreateDefaultShaders

func CreateDefaultShaders() (program gl.Program)

func IsInWedge

func IsInWedge(point, n0, n1 *Dual) bool

func MaxF

func MaxF(x1, x2 float32) float32

func MinF

func MinF(x1, x2 float32) float32

func Sin2Atan

func Sin2Atan(d float32) float32

Returns sin(2 * atan(d))

Types

type Arc

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

func (*Arc) Apex

func (arc *Arc) Apex() *Dual

func (*Arc) EuclideanDistanceTo

func (arc *Arc) EuclideanDistanceTo(point *Dual) float32

func (*Arc) IsInWedge

func (arc *Arc) IsInWedge(point *Dual) bool

func (*Arc) Normals

func (arc *Arc) Normals() (l0, l1 *Dual)

func (*Arc) SignedVectorToClosestArcPoint

func (arc *Arc) SignedVectorToClosestArcPoint(point *Dual) *SignedVector

type DisplayList

type DisplayList struct {
	W, H float32
	// contains filtered or unexported fields
}

TODO(vollick): We need to consider spatial queries, mutability and display list optimization. I am not at all convinced that this representation is ideal for all of these purposes.

func (*DisplayList) DoColor

func (dl *DisplayList) DoColor(program *gl.Program)

func (*DisplayList) DoQuads

func (dl *DisplayList) DoQuads(program *gl.Program)

func (*DisplayList) Draw

func (dl *DisplayList) Draw(program *gl.Program, width, height float32)

func (*DisplayList) DrawPoints

func (dl *DisplayList) DrawPoints(ps []Pointf)

func (*DisplayList) DrawQuads

func (dl *DisplayList) DrawQuads(qs [][4]Pointf)

func (*DisplayList) SetColor

func (dl *DisplayList) SetColor(c color.RGBA)

func (*DisplayList) SetPointSize

func (dl *DisplayList) SetPointSize(s float32)

type Dual

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

Represents both projective points and lines.

func (*Dual) AngularDistanceTo

func (a *Dual) AngularDistanceTo(b *Dual) float32

func (*Dual) Bisector

func (d *Dual) Bisector(other *Dual) *Dual

func (*Dual) Intersection

func (d0 *Dual) Intersection(d1 *Dual) *Dual

func (*Dual) Normalize

func (d *Dual) Normalize() *Dual

func (*Dual) ProjectiveDistanceTo

func (a *Dual) ProjectiveDistanceTo(b *Dual) float32

type Pointf

type Pointf struct {
	X, Y float32
}

A Pointf is an X, Y coordinate pair. The axes increase right and down. TODO(rjkroege|ianvollick): Write conversion Pointf <-> Dual as needed.

var ZP Pointf

ZP is the zero Pointf.

func Ptf

func Ptf(X, Y float32) Pointf

Ptf is shorthand for Pointf{X, Y}.

func Ptfi

func Ptfi(p image.Point) Pointf

Make a Pointf from an integer point

func (Pointf) Add

func (p Pointf) Add(q Pointf) Pointf

Add returns the vector p+q.

func (Pointf) Div

func (p Pointf) Div(k float32) Pointf

Div returns the vector p/k.

func (Pointf) Eq

func (p Pointf) Eq(q Pointf) bool

Eq reports whether p and q are equal.

func (Pointf) In

func (p Pointf) In(r Rectanglef) bool

In reports whether p is in r.

func (Pointf) Mul

func (p Pointf) Mul(k float32) Pointf

Mul returns the vector p*k.

func (Pointf) String

func (p Pointf) String() string

String returns a string representation of p like "(3,4)".

func (Pointf) Sub

func (p Pointf) Sub(q Pointf) Pointf

Sub returns the vector p-q.

type Rectanglef

type Rectanglef struct {
	Min, Max Pointf
}

A Rectanglef contains the points with Min.X <= X < Max.X, Min.Y <= Y < Max.Y. It is well-formed if Min.X <= Max.X and likewise for Y. Pointfs are always well-formed. A rectangle's methods always return well-formed outputs for well-formed inputs.

var ZR Rectanglef

ZR is the zero Rectanglef.

func Rect

func Rect(x0, y0, x1, y1 float32) Rectanglef

Rect is shorthand for Rectanglef{Pt(x0, y0), Pt(x1, y1)}.

func (Rectanglef) Add

func (r Rectanglef) Add(p Pointf) Rectanglef

Add returns the rectangle r translated by p.

func (Rectanglef) Canon

func (r Rectanglef) Canon() Rectanglef

Canon returns the canonical version of r. The returned rectangle has minimum and maximum coordinates swapped if necessary so that it is well-formed.

func (Rectanglef) Dx

func (r Rectanglef) Dx() float32

Dx returns r's width.

func (Rectanglef) Dy

func (r Rectanglef) Dy() float32

Dy returns r's height.

func (Rectanglef) Empty

func (r Rectanglef) Empty() bool

Empty reports whether the rectangle contains no points.

func (Rectanglef) Eq

func (r Rectanglef) Eq(s Rectanglef) bool

Eq reports whether r and s are equal.

func (Rectanglef) In

func (r Rectanglef) In(s Rectanglef) bool

In reports whether every point in r is in s.

func (Rectanglef) Intersect

func (r Rectanglef) Intersect(s Rectanglef) Rectanglef

Intersect returns the largest rectangle contained by both r and s. If the two rectangles do not overlap then the zero rectangle will be returned.

func (Rectanglef) Overlaps

func (r Rectanglef) Overlaps(s Rectanglef) bool

Overlaps reports whether r and s have a non-empty intersection.

func (Rectanglef) Size

func (r Rectanglef) Size() Pointf

Size returns r's width and height.

func (Rectanglef) String

func (r Rectanglef) String() string

String returns a string representation of r like "(3,4)-(6,5)".

func (Rectanglef) Sub

func (r Rectanglef) Sub(p Pointf) Rectanglef

Sub returns the rectangle r translated by -p.

func (Rectanglef) Union

func (r Rectanglef) Union(s Rectanglef) Rectanglef

Union returns the smallest rectangle that contains both r and s.

type SignedVector

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

Jump to

Keyboard shortcuts

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