Documentation
¶
Index ¶
- type Geom
- func (g Geom) Apply(vec [3]float64) (o [3]float64)
- func (g Geom) ApplyPt(p Point) Point
- func (g Geom) ApplyRect(r Rectangle) Rectangle
- func (g Geom) Inverse() (b Geom)
- func (g Geom) Mul(b Geom) (c Geom)
- func (g Geom) Rotate(theta float64) Geom
- func (g Geom) Scale(x, y float64) Geom
- func (g Geom) Shear(x, y float64) Geom
- func (g *Geom) String() string
- func (g Geom) To3d() Geom3d
- func (g Geom) Translate(x, y float64) Geom
- func (g Geom) Transpose() (b Geom)
- type Geom3d
- func Frustum3d(left, right, bottom, top, near, far float64) Geom3d
- func Identity3d() (g Geom3d)
- func Ortho3d(zoom, width, height, near, far float64) Geom3d
- func Perspective3d(fov, aspect, near, far float64) Geom3d
- func Rotate3d(yaw, pitch, roll float64) (p Geom3d)
- func Scale3d(x, y, z float64) (p Geom3d)
- func Translate3d(x, y, z float64) Geom3d
- type Point
- func (p Point) Abs() Point
- func (p Point) Add(q Point) Point
- func (p Point) Ceil() Point
- func (p Point) Cross(q Point) Point3d
- func (p Point) Degrade() image.Point
- func (p Point) Dot(q Point) float64
- func (p Point) Floor() Point
- func (p Point) In(r Rectangle) bool
- func (p Point) Length() float64
- func (p Point) Mix(b, t Point) Point
- func (p Point) Mul(k float64) Point
- func (p Point) Pmax(q Point) Point
- func (p Point) Pmin(q Point) Point
- func (p Point) Pmul(q Point) Point
- func (p Point) String() string
- func (p Point) Sub(q Point) Point
- func (p Point) To3() Point3d
- func (p Point) Triple(q, d Point) float64
- type Point3d
- type Rectangle
- func (r Rectangle) Add(p Point) Rectangle
- func (r Rectangle) Canon() Rectangle
- func (r Rectangle) Center() Point
- func (r Rectangle) Degrade() image.Rectangle
- func (r Rectangle) Distance(at Point) float64
- func (r Rectangle) Dx() float64
- func (r Rectangle) Dy() float64
- func (r Rectangle) Empty() bool
- func (r Rectangle) Eq(s Rectangle) bool
- func (r Rectangle) In(s Rectangle) bool
- func (r Rectangle) Inset(n float64) Rectangle
- func (r Rectangle) Intersect(s Rectangle) Rectangle
- func (r Rectangle) Overlaps(s Rectangle) bool
- func (r Rectangle) Size() Point
- func (r Rectangle) Sub(p Point) Rectangle
- func (r Rectangle) Union(s Rectangle) Rectangle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Geom3d ¶
type Geom3d [4][4]float64
func Identity3d ¶
func Identity3d() (g Geom3d)
func Ortho3d ¶
Ortho3d generates an orthographic projection matrix. Zoom is the relative size of one unit in world coordinates. If width and height are equal to window width and height respectively, zoom is the size of one uint in pixels.
func Perspective3d ¶
Perspective3d generates a perspective projection matrix. Fov is the angle between top and bottom planes of the frustum. Aspect is its aspect ratio.
func Translate3d ¶
type Point ¶
type Point struct {
X, Y float64
}
type Point3d ¶
type Point3d struct {
X, Y, Z float64
}
Point3d is a X, Y and Z coordinate triple.
type Rectangle ¶
type Rectangle struct {
Min, Max Point
}
func PromoteRect ¶
func (Rectangle) Canon ¶
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 (Rectangle) Distance ¶
Distance evaluates signed distance function of the rectangle at the given point. If signed distance is negative, then the point is inside the rectangle. If it is zero, then it is on its boundary.
func (Rectangle) Eq ¶
Eq reports whether r and s contain the same set of points. All empty rectangles are considered equal.
func (Rectangle) Inset ¶
Inset returns the rectangle r inset by n, which may be negative. If either of r's dimensions is less than 2*n then an empty rectangle near the center of r will be returned.
func (Rectangle) Intersect ¶
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.