Documentation ¶
Index ¶
- Constants
- func CheckForGLErrors()
- func Cos2Atan(d float32) float32
- func CreateDefaultShaders() (program gl.Program)
- func IsInWedge(point, n0, n1 *Dual) bool
- func MaxF(x1, x2 float32) float32
- func MinF(x1, x2 float32) float32
- func Sin2Atan(d float32) float32
- type Arc
- type DisplayList
- func (dl *DisplayList) DoColor(program *gl.Program)
- func (dl *DisplayList) DoQuads(program *gl.Program)
- func (dl *DisplayList) Draw(program *gl.Program, width, height float32)
- func (dl *DisplayList) DrawPoints(ps []Pointf)
- func (dl *DisplayList) DrawQuads(qs [][4]Pointf)
- func (dl *DisplayList) SetColor(c color.RGBA)
- func (dl *DisplayList) SetPointSize(s float32)
- type Dual
- type Pointf
- type Rectanglef
- func (r Rectanglef) Add(p Pointf) Rectanglef
- func (r Rectanglef) Canon() Rectanglef
- func (r Rectanglef) Dx() float32
- func (r Rectanglef) Dy() float32
- func (r Rectanglef) Empty() bool
- func (r Rectanglef) Eq(s Rectanglef) bool
- func (r Rectanglef) In(s Rectanglef) bool
- func (r Rectanglef) Intersect(s Rectanglef) Rectanglef
- func (r Rectanglef) Overlaps(s Rectanglef) bool
- func (r Rectanglef) Size() Pointf
- func (r Rectanglef) String() string
- func (r Rectanglef) Sub(p Pointf) Rectanglef
- func (r Rectanglef) Union(s Rectanglef) Rectanglef
- type SignedVector
Constants ¶
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 CreateDefaultShaders ¶
Types ¶
type Arc ¶
type Arc struct {
// contains filtered or unexported fields
}
func (*Arc) EuclideanDistanceTo ¶
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) 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 (*Dual) Intersection ¶
func (*Dual) ProjectiveDistanceTo ¶
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.
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) 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) 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
}