Documentation ¶
Index ¶
- Constants
- Variables
- type Box
- func (box *Box) BoundingSphere() *Sphere
- func (box *Box) Center() *Point3D
- func (a *Box) ContainsBox(b *Box) bool
- func (box *Box) ContainsPoint(point *Point3D) bool
- func (box *Box) Depth() float32
- func (a *Box) Equal(b *Box) bool
- func (box *Box) Expand(point *Point3D) *Box
- func (box *Box) ExpandScalar(scalar float32) *Box
- func (box *Box) ExpandVec3(vec *Vec3) *Box
- func (box *Box) Height() float32
- func (box *Box) Init(min *Point3D, max *Point3D) *Box
- func (box *Box) InitFromBox(src *Box) *Box
- func (box *Box) InitFromPoints(points []Point3D) *Box
- func (box *Box) InitFromVec3(min *Vec3, max *Vec3) *Box
- func (box *Box) InitFromVectors(vectors []Vec3) *Box
- func (a *Box) Intersection(b *Box) (*Box, bool)
- func (box *Box) Max() *Point3D
- func (box *Box) Min() *Point3D
- func (box *Box) Size() *Vec3
- func (a *Box) Union(b *Box) *Box
- func (box *Box) Vertices() [8]Vec3
- func (box *Box) Width() float32
- type Euler
- func (e *Euler) Alpha() float32
- func (e *Euler) Beta() float32
- func (a *Euler) Equal(b *Euler) bool
- func (e *Euler) Gamma() float32
- func (e *Euler) Init(x float32, y float32, z float32) *Euler
- func (e *Euler) InitFromEuler(src *Euler) *Euler
- func (e *Euler) InitFromMatrix(m *Matrix, order EulerOrder) *Euler
- func (e *Euler) InitFromQuaternion(q *Quaternion, order EulerOrder) *Euler
- func (e *Euler) InitFromRadians(x float32, y float32, z float32, order EulerOrder) *Euler
- func (e *Euler) InitFromVec3(v *Vec3, order EulerOrder) *Euler
- func (e *Euler) InitWithOrder(x float32, y float32, z float32, order EulerOrder) *Euler
- func (e *Euler) Order() EulerOrder
- func (e *Euler) Reorder(order EulerOrder) *Euler
- func (e *Euler) ToMatrix() *Matrix
- func (e *Euler) ToQuaternion() *Quaternion
- func (e *Euler) ToVec3() *Vec3
- func (e *Euler) X() float32
- func (e *Euler) Y() float32
- func (e *Euler) Z() float32
- type EulerOrder
- type Frustum
- func (f *Frustum) ContainsPoint(point *Point3D) bool
- func (a *Frustum) Equal(b *Frustum) bool
- func (f *Frustum) Init(p0 *Plane, p1 *Plane, p2 *Plane, p3 *Plane, p4 *Plane, p5 *Plane) *Frustum
- func (f *Frustum) InitFromFrustum(src *Frustum) *Frustum
- func (f *Frustum) InitFromMatrix(matrix *Matrix) *Frustum
- func (f *Frustum) IntersectsBox(box *Box) bool
- func (f *Frustum) IntersectsSphere(sphere *Sphere) bool
- func (f *Frustum) Planes() [6]Plane
- type Matrix
- func (m *Matrix) Decompose() (translate *Vec3, scale *Vec3, rotate *Quaternion, shear *Vec3, ...)
- func (m *Matrix) Determinant() float32
- func (a *Matrix) Equal(b *Matrix) bool
- func (a *Matrix) EqualFast(b *Matrix) bool
- func (m *Matrix) InitFrom2D(xx float64, yx float64, xy float64, yy float64, x0 float64, y0 float64) *Matrix
- func (m *Matrix) InitFromFloat(v [16]float32) *Matrix
- func (m *Matrix) InitFromMatrix(src *Matrix) *Matrix
- func (m *Matrix) InitFromVec4(v0 *Vec4, v1 *Vec4, v2 *Vec4, v3 *Vec4) *Matrix
- func (m *Matrix) InitFrustum(left float32, right float32, bottom float32, top float32, zNear float32, ...) *Matrix
- func (m *Matrix) InitIdentity() *Matrix
- func (m *Matrix) InitLookAt(eye *Vec3, center *Vec3, up *Vec3) *Matrix
- func (m *Matrix) InitOrtho(left float32, right float32, top float32, bottom float32, zNear float32, ...) *Matrix
- func (m *Matrix) InitPerspective(fovy float32, aspect float32, zNear float32, zFar float32) *Matrix
- func (m *Matrix) InitRotate(angle float32, axis *Vec3) *Matrix
- func (m *Matrix) InitScale(x float32, y float32, z float32) *Matrix
- func (m *Matrix) InitSkew(xSkew float32, ySkew float32) *Matrix
- func (m *Matrix) InitTranslate(p *Point3D) *Matrix
- func (a *Matrix) Interpolate(b *Matrix, factor float64) *Matrix
- func (m *Matrix) Inverse() (*Matrix, bool)
- func (m *Matrix) Is2D() bool
- func (m *Matrix) IsBackfaceVisible() bool
- func (m *Matrix) IsIdentity() bool
- func (m *Matrix) IsSingular() bool
- func (a *Matrix) Multiply(b *Matrix) *Matrix
- func (a *Matrix) Near(b *Matrix, epsilon float32) bool
- func (m *Matrix) Normalize() *Matrix
- func (m *Matrix) Perspective(depth float32) *Matrix
- func (m *Matrix) Print()
- func (m *Matrix) ProjectPoint(p *Point) *Point
- func (m *Matrix) ProjectRect(r *Rect) *Quad
- func (m *Matrix) ProjectRectBounds(r *Rect) *Rect
- func (m *Matrix) Rotate(angle float32, axis *Vec3)
- func (m *Matrix) RotateEuler(e *Euler)
- func (m *Matrix) RotateQuaternion(q *Quaternion)
- func (m *Matrix) RotateX(angle float32)
- func (m *Matrix) RotateY(angle float32)
- func (m *Matrix) RotateZ(angle float32)
- func (m *Matrix) Row(index_ uint) *Vec4
- func (m *Matrix) Scale(factorX float32, factorY float32, factorZ float32)
- func (m *Matrix) SkewXY(factor float32)
- func (m *Matrix) SkewXZ(factor float32)
- func (m *Matrix) SkewYZ(factor float32)
- func (m *Matrix) To2D() (xx float64, yx float64, xy float64, yy float64, x0 float64, y0 float64, ...)
- func (m *Matrix) ToFloat() [16]float32
- func (m *Matrix) TransformBounds(r *Rect) *Rect
- func (m *Matrix) TransformBox(b *Box) *Box
- func (m *Matrix) TransformPoint(p *Point) *Point
- func (m *Matrix) TransformPoint3D(p *Point3D) *Point3D
- func (m *Matrix) TransformRay(r *Ray) *Ray
- func (m *Matrix) TransformRect(r *Rect) *Quad
- func (m *Matrix) TransformSphere(s *Sphere) *Sphere
- func (m *Matrix) TransformVec3(v *Vec3) *Vec3
- func (m *Matrix) TransformVec4(v *Vec4) *Vec4
- func (m *Matrix) Translate(pos *Point3D)
- func (m *Matrix) Transpose() *Matrix
- func (projection *Matrix) UnprojectPoint3D(modelview *Matrix, point *Point3D) *Point3D
- func (m *Matrix) UntransformBounds(r *Rect, bounds *Rect) *Rect
- func (m *Matrix) UntransformPoint(p *Point, bounds *Rect) (*Point, bool)
- func (m *Matrix) Value(row uint, col uint) float32
- func (m *Matrix) XScale() float32
- func (m *Matrix) XTranslation() float32
- func (m *Matrix) YScale() float32
- func (m *Matrix) YTranslation() float32
- func (m *Matrix) ZScale() float32
- func (m *Matrix) ZTranslation() float32
- type Plane
- func (p *Plane) Constant() float32
- func (p *Plane) Distance(point *Point3D) float32
- func (a *Plane) Equal(b *Plane) bool
- func (p *Plane) Init(normal *Vec3, constant float32) *Plane
- func (p *Plane) InitFromPlane(src *Plane) *Plane
- func (p *Plane) InitFromPoint(normal *Vec3, point *Point3D) *Plane
- func (p *Plane) InitFromPoints(a *Point3D, b *Point3D, c *Point3D) *Plane
- func (p *Plane) InitFromVec4(src *Vec4) *Plane
- func (p *Plane) Negate() *Plane
- func (p *Plane) Normal() *Vec3
- func (p *Plane) Normalize() *Plane
- func (p *Plane) Transform(matrix *Matrix, normalMatrix *Matrix) *Plane
- type Point
- func (a *Point) Distance(b *Point) (dX float32, dY float32, gfloat float32)
- func (a *Point) Equal(b *Point) bool
- func (p *Point) Init(x float32, y float32) *Point
- func (p *Point) InitFromPoint(src *Point) *Point
- func (p *Point) InitFromVec2(src *Vec2) *Point
- func (a *Point) Interpolate(b *Point, factor float64) *Point
- func (a *Point) Near(b *Point, epsilon float32) bool
- func (p *Point) SetX(x float32)
- func (p *Point) SetY(y float32)
- func (p *Point) ToVec2() *Vec2
- func (p *Point) X() float32
- func (p *Point) Y() float32
- type Point3D
- func (a *Point3D) Cross(b *Point3D) *Point3D
- func (a *Point3D) Distance(b *Point3D) (*Vec3, float32)
- func (a *Point3D) Dot(b *Point3D) float32
- func (a *Point3D) Equal(b *Point3D) bool
- func (p *Point3D) Init(x float32, y float32, z float32) *Point3D
- func (p *Point3D) InitFromPoint(src *Point3D) *Point3D
- func (p *Point3D) InitFromVec3(v *Vec3) *Point3D
- func (a *Point3D) Interpolate(b *Point3D, factor float64) *Point3D
- func (p *Point3D) Length() float32
- func (a *Point3D) Near(b *Point3D, epsilon float32) bool
- func (p *Point3D) Normalize() *Point3D
- func (p *Point3D) NormalizeViewport(viewport *Rect, zNear float32, zFar float32) *Point3D
- func (p *Point3D) Scale(factor float32) *Point3D
- func (p *Point3D) SetX(x float32)
- func (p *Point3D) SetY(y float32)
- func (p *Point3D) SetZ(z float32)
- func (p *Point3D) ToVec3() *Vec3
- func (p *Point3D) X() float32
- func (p *Point3D) Y() float32
- func (p *Point3D) Z() float32
- type Quad
- type Quaternion
- func (a *Quaternion) Add(b *Quaternion) *Quaternion
- func (a *Quaternion) Dot(b *Quaternion) float32
- func (a *Quaternion) Equal(b *Quaternion) bool
- func (q *Quaternion) Init(x float32, y float32, z float32, w float32) *Quaternion
- func (q *Quaternion) InitFromAngleVec3(angle float32, axis *Vec3) *Quaternion
- func (q *Quaternion) InitFromAngles(degX float32, degY float32, degZ float32) *Quaternion
- func (q *Quaternion) InitFromEuler(e *Euler) *Quaternion
- func (q *Quaternion) InitFromMatrix(m *Matrix) *Quaternion
- func (q *Quaternion) InitFromQuaternion(src *Quaternion) *Quaternion
- func (q *Quaternion) InitFromRadians(radX float32, radY float32, radZ float32) *Quaternion
- func (q *Quaternion) InitFromVec4(src *Vec4) *Quaternion
- func (q *Quaternion) InitIdentity() *Quaternion
- func (q *Quaternion) Invert() *Quaternion
- func (a *Quaternion) Multiply(b *Quaternion) *Quaternion
- func (q *Quaternion) Normalize() *Quaternion
- func (q *Quaternion) Scale(factor float32) *Quaternion
- func (a *Quaternion) Slerp(b *Quaternion, factor float32) *Quaternion
- func (q *Quaternion) ToAngleVec3() (float32, *Vec3)
- func (q *Quaternion) ToAngles() (degX float32, degY float32, degZ float32)
- func (q *Quaternion) ToMatrix() *Matrix
- func (q *Quaternion) ToRadians() (radX float32, radY float32, radZ float32)
- func (q *Quaternion) ToVec4() *Vec4
- type Ray
- func (r *Ray) ClosestPointToPoint(p *Point3D) *Point3D
- func (r *Ray) Direction() *Vec3
- func (r *Ray) DistanceToPlane(p *Plane) float32
- func (r *Ray) DistanceToPoint(p *Point3D) float32
- func (a *Ray) Equal(b *Ray) bool
- func (r *Ray) Init(origin *Point3D, direction *Vec3) *Ray
- func (r *Ray) InitFromRay(src *Ray) *Ray
- func (r *Ray) InitFromVec3(origin *Vec3, direction *Vec3) *Ray
- func (r *Ray) IntersectBox(b *Box) (float32, RayIntersectionKind)
- func (r *Ray) IntersectSphere(s *Sphere) (float32, RayIntersectionKind)
- func (r *Ray) IntersectTriangle(t *Triangle) (float32, RayIntersectionKind)
- func (r *Ray) IntersectsBox(b *Box) bool
- func (r *Ray) IntersectsSphere(s *Sphere) bool
- func (r *Ray) IntersectsTriangle(t *Triangle) bool
- func (r *Ray) Origin() *Point3D
- func (r *Ray) PositionAt(t float32) *Point3D
- type RayIntersectionKind
- type Rect
- func (r *Rect) Area() float32
- func (r *Rect) BottomLeft() *Point
- func (r *Rect) BottomRight() *Point
- func (r *Rect) Center() *Point
- func (r *Rect) ContainsPoint(p *Point) bool
- func (a *Rect) ContainsRect(b *Rect) bool
- func (a *Rect) Equal(b *Rect) bool
- func (r *Rect) Expand(p *Point) *Rect
- func (r *Rect) Height() float32
- func (r *Rect) Init(x float32, y float32, width float32, height float32) *Rect
- func (r *Rect) InitFromRect(src *Rect) *Rect
- func (r *Rect) Inset(dX float32, dY float32) *Rect
- func (r *Rect) InsetR(dX float32, dY float32) *Rect
- func (a *Rect) Interpolate(b *Rect, factor float64) *Rect
- func (a *Rect) Intersection(b *Rect) (*Rect, bool)
- func (r *Rect) Normalize() *Rect
- func (r *Rect) NormalizeR() *Rect
- func (r *Rect) Offset(dX float32, dY float32) *Rect
- func (r *Rect) OffsetR(dX float32, dY float32) *Rect
- func (r *Rect) Origin() *Point
- func (r *Rect) Round() *Rectdeprecated
- func (r *Rect) RoundExtents() *Rect
- func (r *Rect) RoundToPixel() *Rectdeprecated
- func (r *Rect) Scale(sH float32, sV float32) *Rect
- func (r *Rect) Size() *Size
- func (r *Rect) TopLeft() *Point
- func (r *Rect) TopRight() *Point
- func (a *Rect) Union(b *Rect) *Rect
- func (r *Rect) Vertices() [4]Vec2
- func (r *Rect) Width() float32
- func (r *Rect) X() float32
- func (r *Rect) Y() float32
- type SIMD4F
- type SIMD4X4F
- type Size
- func (a *Size) Equal(b *Size) bool
- func (s *Size) Height() float32
- func (s *Size) Init(width float32, height float32) *Size
- func (s *Size) InitFromSize(src *Size) *Size
- func (a *Size) Interpolate(b *Size, factor float64) *Size
- func (s *Size) Scale(factor float32) *Size
- func (s *Size) SetHeight(height float32)
- func (s *Size) SetWidth(width float32)
- func (s *Size) Width() float32
- type Sphere
- func (s *Sphere) BoundingBox() *Box
- func (s *Sphere) Center() *Point3D
- func (s *Sphere) ContainsPoint(point *Point3D) bool
- func (s *Sphere) Distance(point *Point3D) float32
- func (a *Sphere) Equal(b *Sphere) bool
- func (s *Sphere) Init(center *Point3D, radius float32) *Sphere
- func (s *Sphere) InitFromPoints(points []Point3D, center *Point3D) *Sphere
- func (s *Sphere) InitFromVectors(vectors []Vec3, center *Point3D) *Sphere
- func (s *Sphere) IsEmpty() bool
- func (s *Sphere) Radius() float32
- func (s *Sphere) Translate(point *Point3D) *Sphere
- type Triangle
- func (t *Triangle) Area() float32
- func (t *Triangle) Barycoords(p *Point3D) (*Vec2, bool)
- func (t *Triangle) BoundingBox() *Box
- func (t *Triangle) ContainsPoint(p *Point3D) bool
- func (a *Triangle) Equal(b *Triangle) bool
- func (t *Triangle) InitFromFloat(a [3]float32, b [3]float32, c [3]float32) *Triangle
- func (t *Triangle) InitFromPoint3D(a *Point3D, b *Point3D, c *Point3D) *Triangle
- func (t *Triangle) InitFromVec3(a *Vec3, b *Vec3, c *Vec3) *Triangle
- func (t *Triangle) Midpoint() *Point3D
- func (t *Triangle) Normal() *Vec3
- func (t *Triangle) Plane() *Plane
- func (t *Triangle) Points() (a *Point3D, b *Point3D, c *Point3D)
- func (t *Triangle) Uv(p *Point3D, uvA *Vec2, uvB *Vec2, uvC *Vec2) (*Vec2, bool)
- func (t *Triangle) Vertices() (a *Vec3, b *Vec3, c *Vec3)
- type Vec2
- func (a *Vec2) Add(b *Vec2) *Vec2
- func (a *Vec2) Divide(b *Vec2) *Vec2
- func (a *Vec2) Dot(b *Vec2) float32
- func (v1 *Vec2) Equal(v2 *Vec2) bool
- func (v *Vec2) Init(x float32, y float32) *Vec2
- func (v *Vec2) InitFromFloat(src [2]float32) *Vec2
- func (v *Vec2) InitFromVec2(src *Vec2) *Vec2
- func (v1 *Vec2) Interpolate(v2 *Vec2, factor float64) *Vec2
- func (v *Vec2) Length() float32
- func (a *Vec2) Max(b *Vec2) *Vec2
- func (a *Vec2) Min(b *Vec2) *Vec2
- func (a *Vec2) Multiply(b *Vec2) *Vec2
- func (v1 *Vec2) Near(v2 *Vec2, epsilon float32) bool
- func (v *Vec2) Negate() *Vec2
- func (v *Vec2) Normalize() *Vec2
- func (v *Vec2) Scale(factor float32) *Vec2
- func (a *Vec2) Subtract(b *Vec2) *Vec2
- func (v *Vec2) ToFloat() [2]float32
- func (v *Vec2) X() float32
- func (v *Vec2) Y() float32
- type Vec3
- func (a *Vec3) Add(b *Vec3) *Vec3
- func (a *Vec3) Cross(b *Vec3) *Vec3
- func (a *Vec3) Divide(b *Vec3) *Vec3
- func (a *Vec3) Dot(b *Vec3) float32
- func (v1 *Vec3) Equal(v2 *Vec3) bool
- func (v *Vec3) Init(x float32, y float32, z float32) *Vec3
- func (v *Vec3) InitFromFloat(src [3]float32) *Vec3
- func (v *Vec3) InitFromVec3(src *Vec3) *Vec3
- func (v1 *Vec3) Interpolate(v2 *Vec3, factor float64) *Vec3
- func (v *Vec3) Length() float32
- func (a *Vec3) Max(b *Vec3) *Vec3
- func (a *Vec3) Min(b *Vec3) *Vec3
- func (a *Vec3) Multiply(b *Vec3) *Vec3
- func (v1 *Vec3) Near(v2 *Vec3, epsilon float32) bool
- func (v *Vec3) Negate() *Vec3
- func (v *Vec3) Normalize() *Vec3
- func (v *Vec3) Scale(factor float32) *Vec3
- func (a *Vec3) Subtract(b *Vec3) *Vec3
- func (v *Vec3) ToFloat() [3]float32
- func (v *Vec3) X() float32
- func (v *Vec3) XY() *Vec2
- func (v *Vec3) XY0() *Vec3
- func (v *Vec3) XYZ0() *Vec4
- func (v *Vec3) XYZ1() *Vec4
- func (v *Vec3) Xyzw(w float32) *Vec4
- func (v *Vec3) Y() float32
- func (v *Vec3) Z() float32
- type Vec4
- func (a *Vec4) Add(b *Vec4) *Vec4
- func (a *Vec4) Divide(b *Vec4) *Vec4
- func (a *Vec4) Dot(b *Vec4) float32
- func (v1 *Vec4) Equal(v2 *Vec4) bool
- func (v *Vec4) Init(x float32, y float32, z float32, w float32) *Vec4
- func (v *Vec4) InitFromFloat(src [4]float32) *Vec4
- func (v *Vec4) InitFromVec2(src *Vec2, z float32, w float32) *Vec4
- func (v *Vec4) InitFromVec3(src *Vec3, w float32) *Vec4
- func (v *Vec4) InitFromVec4(src *Vec4) *Vec4
- func (v1 *Vec4) Interpolate(v2 *Vec4, factor float64) *Vec4
- func (v *Vec4) Length() float32
- func (a *Vec4) Max(b *Vec4) *Vec4
- func (a *Vec4) Min(b *Vec4) *Vec4
- func (a *Vec4) Multiply(b *Vec4) *Vec4
- func (v1 *Vec4) Near(v2 *Vec4, epsilon float32) bool
- func (v *Vec4) Negate() *Vec4
- func (v *Vec4) Normalize() *Vec4
- func (v *Vec4) Scale(factor float32) *Vec4
- func (a *Vec4) Subtract(b *Vec4) *Vec4
- func (v *Vec4) ToFloat() [4]float32
- func (v *Vec4) W() float32
- func (v *Vec4) X() float32
- func (v *Vec4) XY() *Vec2
- func (v *Vec4) XYZ() *Vec3
- func (v *Vec4) Y() float32
- func (v *Vec4) Z() float32
Constants ¶
const PI = 3.141593
const PI_2 = 1.570796
const VEC2_LEN = 2
VEC2_LEN evaluates to the number of components of a #graphene_vec2_t.
This symbol is useful when declaring a C array of floating point values to be used with graphene_vec2_init_from_float() and graphene_vec2_to_float(), e.g.
float v[GRAPHENE_VEC2_LEN]; // vec is defined elsewhere graphene_vec2_to_float (&vec, v); for (int i = 0; i < GRAPHENE_VEC2_LEN; i++) fprintf (stdout, "component d: g\n", i, v[i]);.
const VEC3_LEN = 3
VEC3_LEN evaluates to the number of components of a #graphene_vec3_t.
This symbol is useful when declaring a C array of floating point values to be used with graphene_vec3_init_from_float() and graphene_vec3_to_float(), e.g.
float v[GRAPHENE_VEC3_LEN]; // vec is defined elsewhere graphene_vec3_to_float (&vec, v); for (int i = 0; i < GRAPHENE_VEC2_LEN; i++) fprintf (stdout, "component d: g\n", i, v[i]);.
const VEC4_LEN = 4
VEC4_LEN evaluates to the number of components of a #graphene_vec4_t.
This symbol is useful when declaring a C array of floating point values to be used with graphene_vec4_init_from_float() and graphene_vec4_to_float(), e.g.
float v[GRAPHENE_VEC4_LEN]; // vec is defined elsewhere graphene_vec4_to_float (&vec, v); for (int i = 0; i < GRAPHENE_VEC4_LEN; i++) fprintf (stdout, "component d: g\n", i, v[i]);.
Variables ¶
var ( GTypeBox = coreglib.Type(C.graphene_box_get_type()) GTypeEuler = coreglib.Type(C.graphene_euler_get_type()) GTypeFrustum = coreglib.Type(C.graphene_frustum_get_type()) GTypeMatrix = coreglib.Type(C.graphene_matrix_get_type()) GTypePlane = coreglib.Type(C.graphene_plane_get_type()) GTypePoint = coreglib.Type(C.graphene_point_get_type()) GTypePoint3D = coreglib.Type(C.graphene_point3d_get_type()) GTypeQuad = coreglib.Type(C.graphene_quad_get_type()) GTypeQuaternion = coreglib.Type(C.graphene_quaternion_get_type()) GTypeRay = coreglib.Type(C.graphene_ray_get_type()) GTypeRect = coreglib.Type(C.graphene_rect_get_type()) GTypeSize = coreglib.Type(C.graphene_size_get_type()) GTypeSphere = coreglib.Type(C.graphene_sphere_get_type()) GTypeTriangle = coreglib.Type(C.graphene_triangle_get_type()) GTypeVec2 = coreglib.Type(C.graphene_vec2_get_type()) GTypeVec3 = coreglib.Type(C.graphene_vec3_get_type()) GTypeVec4 = coreglib.Type(C.graphene_vec4_get_type()) )
GType values.
Functions ¶
This section is empty.
Types ¶
type Box ¶
type Box struct {
// contains filtered or unexported fields
}
Box: 3D box, described as the volume between a minimum and a maximum vertices.
An instance of this type is always passed by reference.
func BoxEmpty ¶
func BoxEmpty() *Box
BoxEmpty: degenerate #graphene_box_t that can only be expanded.
The returned value is owned by Graphene and should not be modified or freed.
The function returns the following values:
- box: #graphene_box_t.
func BoxInfinite ¶
func BoxInfinite() *Box
BoxInfinite: degenerate #graphene_box_t that cannot be expanded.
The returned value is owned by Graphene and should not be modified or freed.
The function returns the following values:
- box: #graphene_box_t.
func BoxMinusOne ¶
func BoxMinusOne() *Box
BoxMinusOne with the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (0, 0, 0).
The returned value is owned by Graphene and should not be modified or freed.
The function returns the following values:
- box: #graphene_box_t.
func BoxOne ¶
func BoxOne() *Box
BoxOne with the minimum vertex set at (0, 0, 0) and the maximum vertex set at (1, 1, 1).
The returned value is owned by Graphene and should not be modified or freed.
The function returns the following values:
- box: #graphene_box_t.
func BoxOneMinusOne ¶
func BoxOneMinusOne() *Box
BoxOneMinusOne with the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (1, 1, 1).
The returned value is owned by Graphene and should not be modified or freed.
The function returns the following values:
- box: #graphene_box_t.
func BoxZero ¶
func BoxZero() *Box
BoxZero with both the minimum and maximum vertices set at (0, 0, 0).
The returned value is owned by Graphene and should not be modified or freed.
The function returns the following values:
- box: #graphene_box_t.
func (*Box) BoundingSphere ¶
BoundingSphere computes the bounding #graphene_sphere_t capable of containing the given #graphene_box_t.
The function returns the following values:
- sphere: return location for the bounding sphere.
func (*Box) Center ¶
Center retrieves the coordinates of the center of a #graphene_box_t.
The function returns the following values:
- center: return location for the coordinates of the center.
func (*Box) ContainsBox ¶
ContainsBox checks whether the #graphene_box_t a contains the given #graphene_box_t b.
The function takes the following parameters:
- b: #graphene_box_t.
The function returns the following values:
- ok: true if the box is contained in the given box.
func (*Box) ContainsPoint ¶
ContainsPoint checks whether box contains the given point.
The function takes the following parameters:
- point coordinates to check.
The function returns the following values:
- ok: true if the point is contained in the given box.
func (*Box) Depth ¶
Depth retrieves the size of the box on the Z axis.
The function returns the following values:
- gfloat: depth of the box.
func (*Box) Equal ¶
Equal checks whether the two given boxes are equal.
The function takes the following parameters:
- b: #graphene_box_t.
The function returns the following values:
- ok: true if the boxes are equal.
func (*Box) Expand ¶
Expand expands the dimensions of box to include the coordinates at point.
The function takes the following parameters:
- point coordinates of the point to include.
The function returns the following values:
- res: return location for the expanded box.
func (*Box) ExpandScalar ¶
ExpandScalar expands the dimensions of box by the given scalar value.
If scalar is positive, the #graphene_box_t will grow; if scalar is negative, the #graphene_box_t will shrink.
The function takes the following parameters:
- scalar value.
The function returns the following values:
- res: return location for the expanded box.
func (*Box) ExpandVec3 ¶
ExpandVec3 expands the dimensions of box to include the coordinates of the given vector.
The function takes the following parameters:
- vec coordinates of the point to include, as a #graphene_vec3_t.
The function returns the following values:
- res: return location for the expanded box.
func (*Box) Height ¶
Height retrieves the size of the box on the Y axis.
The function returns the following values:
- gfloat: height of the box.
func (*Box) Init ¶
Init initializes the given #graphene_box_t with two vertices.
The function takes the following parameters:
- min (optional) coordinates of the minimum vertex.
- max (optional) coordinates of the maximum vertex.
The function returns the following values:
- ret: initialized #graphene_box_t.
func (*Box) InitFromBox ¶
InitFromBox initializes the given #graphene_box_t with the vertices of another #graphene_box_t.
The function takes the following parameters:
- src: #graphene_box_t.
The function returns the following values:
- ret: initialized #graphene_box_t.
func (*Box) InitFromPoints ¶
InitFromPoints initializes the given #graphene_box_t with the given array of vertices.
If n_points is 0, the returned box is initialized with graphene_box_empty().
The function takes the following parameters:
- points: array of #graphene_point3d_t.
The function returns the following values:
- ret: initialized #graphene_box_t.
func (*Box) InitFromVec3 ¶
InitFromVec3 initializes the given #graphene_box_t with two vertices stored inside #graphene_vec3_t.
The function takes the following parameters:
- min (optional) coordinates of the minimum vertex.
- max (optional) coordinates of the maximum vertex.
The function returns the following values:
- ret: initialized #graphene_box_t.
func (*Box) InitFromVectors ¶
InitFromVectors initializes the given #graphene_box_t with the given array of vertices.
If n_vectors is 0, the returned box is initialized with graphene_box_empty().
The function takes the following parameters:
- vectors: array of #graphene_vec3_t.
The function returns the following values:
- ret: initialized #graphene_box_t.
func (*Box) Intersection ¶
Intersection intersects the two given #graphene_box_t.
If the two boxes do not intersect, res will contain a degenerate box initialized with graphene_box_empty().
The function takes the following parameters:
- b: #graphene_box_t.
The function returns the following values:
- res (optional): return location for the result.
- ok: true if the two boxes intersect.
func (*Box) Max ¶
Max retrieves the coordinates of the maximum point of the given #graphene_box_t.
The function returns the following values:
- max: return location for the maximum point.
func (*Box) Min ¶
Min retrieves the coordinates of the minimum point of the given #graphene_box_t.
The function returns the following values:
- min: return location for the minimum point.
func (*Box) Size ¶
Size retrieves the size of the box on all three axes, and stores it into the given size vector.
The function returns the following values:
- size: return location for the size.
func (*Box) Union ¶
Union unions the two given #graphene_box_t.
The function takes the following parameters:
- b: box to union to a.
The function returns the following values:
- res: return location for the result.
type Euler ¶
type Euler struct {
// contains filtered or unexported fields
}
Euler: describe a rotation using Euler angles.
The contents of the #graphene_euler_t structure are private and should never be accessed directly.
An instance of this type is always passed by reference.
func (*Euler) Alpha ¶
Alpha retrieves the first component of the Euler angle vector, depending on the order of rotation.
See also: graphene_euler_get_x().
The function returns the following values:
- gfloat: first component of the Euler angle vector, in radians.
func (*Euler) Beta ¶
Beta retrieves the second component of the Euler angle vector, depending on the order of rotation.
See also: graphene_euler_get_y().
The function returns the following values:
- gfloat: second component of the Euler angle vector, in radians.
func (*Euler) Equal ¶
Equal checks if two #graphene_euler_t are equal.
The function takes the following parameters:
- b: #graphene_euler_t.
The function returns the following values:
- ok: true if the two #graphene_euler_t are equal.
func (*Euler) Gamma ¶
Gamma retrieves the third component of the Euler angle vector, depending on the order of rotation.
See also: graphene_euler_get_z().
The function returns the following values:
- gfloat: third component of the Euler angle vector, in radians.
func (*Euler) Init ¶
Init initializes a #graphene_euler_t using the given angles.
The order of the rotations is GRAPHENE_EULER_ORDER_DEFAULT.
The function takes the following parameters:
- x: rotation angle on the X axis, in degrees.
- y: rotation angle on the Y axis, in degrees.
- z: rotation angle on the Z axis, in degrees.
The function returns the following values:
- euler: initialized #graphene_euler_t.
func (*Euler) InitFromEuler ¶
InitFromEuler initializes a #graphene_euler_t using the angles and order of another #graphene_euler_t.
If the #graphene_euler_t src is NULL, this function is equivalent to calling graphene_euler_init() with all angles set to 0.
The function takes the following parameters:
- src (optional): #graphene_euler_t.
The function returns the following values:
- euler: initialized #graphene_euler_t.
func (*Euler) InitFromMatrix ¶
func (e *Euler) InitFromMatrix(m *Matrix, order EulerOrder) *Euler
InitFromMatrix initializes a #graphene_euler_t using the given rotation matrix.
If the #graphene_matrix_t m is NULL, the #graphene_euler_t will be initialized with all angles set to 0.
The function takes the following parameters:
- m (optional): rotation matrix.
- order used to apply the rotations.
The function returns the following values:
- euler: initialized #graphene_euler_t.
func (*Euler) InitFromQuaternion ¶
func (e *Euler) InitFromQuaternion(q *Quaternion, order EulerOrder) *Euler
InitFromQuaternion initializes a #graphene_euler_t using the given normalized quaternion.
If the #graphene_quaternion_t q is NULL, the #graphene_euler_t will be initialized with all angles set to 0.
The function takes the following parameters:
- q (optional): normalized #graphene_quaternion_t.
- order used to apply the rotations.
The function returns the following values:
- euler: initialized #graphene_euler_t.
func (*Euler) InitFromRadians ¶
InitFromRadians initializes a #graphene_euler_t using the given angles and order of rotation.
The function takes the following parameters:
- x: rotation angle on the X axis, in radians.
- y: rotation angle on the Y axis, in radians.
- z: rotation angle on the Z axis, in radians.
- order of rotations.
The function returns the following values:
- euler: initialized #graphene_euler_t.
func (*Euler) InitFromVec3 ¶
func (e *Euler) InitFromVec3(v *Vec3, order EulerOrder) *Euler
InitFromVec3 initializes a #graphene_euler_t using the angles contained in a #graphene_vec3_t.
If the #graphene_vec3_t v is NULL, the #graphene_euler_t will be initialized with all angles set to 0.
The function takes the following parameters:
- v (optional) containing the rotation angles in degrees.
- order used to apply the rotations.
The function returns the following values:
- euler: initialized #graphene_euler_t.
func (*Euler) InitWithOrder ¶
InitWithOrder initializes a #graphene_euler_t with the given angles and order.
The function takes the following parameters:
- x: rotation angle on the X axis, in degrees.
- y: rotation angle on the Y axis, in degrees.
- z: rotation angle on the Z axis, in degrees.
- order used to apply the rotations.
The function returns the following values:
- euler: initialized #graphene_euler_t.
func (*Euler) Order ¶
func (e *Euler) Order() EulerOrder
Order retrieves the order used to apply the rotations described in the #graphene_euler_t structure, when converting to and from other structures, like #graphene_quaternion_t and #graphene_matrix_t.
This function does not return the GRAPHENE_EULER_ORDER_DEFAULT enumeration value; it will return the effective order of rotation instead.
The function returns the following values:
- eulerOrder: order used to apply the rotations.
func (*Euler) Reorder ¶
func (e *Euler) Reorder(order EulerOrder) *Euler
Reorder reorders a #graphene_euler_t using order.
This function is equivalent to creating a #graphene_quaternion_t from the given #graphene_euler_t, and then converting the quaternion into another #graphene_euler_t.
The function takes the following parameters:
- order: new order.
The function returns the following values:
- res: return location for the reordered #graphene_euler_t.
func (*Euler) ToMatrix ¶
ToMatrix converts a #graphene_euler_t into a transformation matrix expressing the extrinsic composition of rotations described by the Euler angles.
The rotations are applied over the reference frame axes in the order associated with the #graphene_euler_t; for instance, if the order used to initialize e is GRAPHENE_EULER_ORDER_XYZ:
- the first rotation moves the body around the X axis with an angle φ
- the second rotation moves the body around the Y axis with an angle of ϑ
- the third rotation moves the body around the Z axis with an angle of ψ
The rotation sign convention is right-handed, to preserve compatibility between Euler-based, quaternion-based, and angle-axis-based rotations.
The function returns the following values:
- res: return location for a #graphene_matrix_t.
func (*Euler) ToQuaternion ¶
func (e *Euler) ToQuaternion() *Quaternion
ToQuaternion converts a #graphene_euler_t into a #graphene_quaternion_t.
The function returns the following values:
- res: return location for a #graphene_quaternion_t.
func (*Euler) ToVec3 ¶
ToVec3 retrieves the angles of a #graphene_euler_t and initializes a #graphene_vec3_t with them.
The function returns the following values:
- res: return location for a #graphene_vec3_t.
func (*Euler) X ¶
X retrieves the rotation angle on the X axis, in degrees.
The function returns the following values:
- gfloat: rotation angle.
type EulerOrder ¶
EulerOrder: specify the order of the rotations on each axis.
The GRAPHENE_EULER_ORDER_DEFAULT value is special, and is used as an alias for one of the other orders.
const ( // EulerOrderDefault: rotate in the default order; the default order is one // of the following enumeration values. EulerOrderDefault EulerOrder = -1 // EulerOrderXYZ: rotate in the X, Y, and Z order. Deprecated in Graphene // 1.10, it's an alias for GRAPHENE_EULER_ORDER_SXYZ. EulerOrderXYZ EulerOrder = 0 // EulerOrderYZX: rotate in the Y, Z, and X order. Deprecated in Graphene // 1.10, it's an alias for GRAPHENE_EULER_ORDER_SYZX. EulerOrderYZX EulerOrder = 1 // EulerOrderZXY: rotate in the Z, X, and Y order. Deprecated in Graphene // 1.10, it's an alias for GRAPHENE_EULER_ORDER_SZXY. EulerOrderZXY EulerOrder = 2 // EulerOrderXZY: rotate in the X, Z, and Y order. Deprecated in Graphene // 1.10, it's an alias for GRAPHENE_EULER_ORDER_SXZY. EulerOrderXZY EulerOrder = 3 // EulerOrderYXZ: rotate in the Y, X, and Z order. Deprecated in Graphene // 1.10, it's an alias for GRAPHENE_EULER_ORDER_SYXZ. EulerOrderYXZ EulerOrder = 4 // EulerOrderZYX: rotate in the Z, Y, and X order. Deprecated in Graphene // 1.10, it's an alias for GRAPHENE_EULER_ORDER_SZYX. EulerOrderZYX EulerOrder = 5 // EulerOrderSXYZ defines a static rotation along the X, Y, and Z axes // (Since: 1.10). EulerOrderSXYZ EulerOrder = 6 // EulerOrderSXYX defines a static rotation along the X, Y, and X axes // (Since: 1.10). EulerOrderSXYX EulerOrder = 7 // EulerOrderSXZY defines a static rotation along the X, Z, and Y axes // (Since: 1.10). EulerOrderSXZY EulerOrder = 8 // EulerOrderSXZX defines a static rotation along the X, Z, and X axes // (Since: 1.10). EulerOrderSXZX EulerOrder = 9 // EulerOrderSYZX defines a static rotation along the Y, Z, and X axes // (Since: 1.10). EulerOrderSYZX EulerOrder = 10 // EulerOrderSYZY defines a static rotation along the Y, Z, and Y axes // (Since: 1.10). EulerOrderSYZY EulerOrder = 11 // EulerOrderSYXZ defines a static rotation along the Y, X, and Z axes // (Since: 1.10). EulerOrderSYXZ EulerOrder = 12 // EulerOrderSYXY defines a static rotation along the Y, X, and Y axes // (Since: 1.10). EulerOrderSYXY EulerOrder = 13 // EulerOrderSZXY defines a static rotation along the Z, X, and Y axes // (Since: 1.10). EulerOrderSZXY EulerOrder = 14 // EulerOrderSZXZ defines a static rotation along the Z, X, and Z axes // (Since: 1.10). EulerOrderSZXZ EulerOrder = 15 // EulerOrderSZYX defines a static rotation along the Z, Y, and X axes // (Since: 1.10). EulerOrderSZYX EulerOrder = 16 // EulerOrderSZYZ defines a static rotation along the Z, Y, and Z axes // (Since: 1.10). EulerOrderSZYZ EulerOrder = 17 // EulerOrderRZYX defines a relative rotation along the Z, Y, and X axes // (Since: 1.10). EulerOrderRZYX EulerOrder = 18 // EulerOrderRXYX defines a relative rotation along the X, Y, and X axes // (Since: 1.10). EulerOrderRXYX EulerOrder = 19 // EulerOrderRYZX defines a relative rotation along the Y, Z, and X axes // (Since: 1.10). EulerOrderRYZX EulerOrder = 20 // EulerOrderRXZX defines a relative rotation along the X, Z, and X axes // (Since: 1.10). EulerOrderRXZX EulerOrder = 21 // EulerOrderRXZY defines a relative rotation along the X, Z, and Y axes // (Since: 1.10). EulerOrderRXZY EulerOrder = 22 // EulerOrderRYZY defines a relative rotation along the Y, Z, and Y axes // (Since: 1.10). EulerOrderRYZY EulerOrder = 23 // EulerOrderRZXY defines a relative rotation along the Z, X, and Y axes // (Since: 1.10). EulerOrderRZXY EulerOrder = 24 // EulerOrderRYXY defines a relative rotation along the Y, X, and Y axes // (Since: 1.10). EulerOrderRYXY EulerOrder = 25 // EulerOrderRYXZ defines a relative rotation along the Y, X, and Z axes // (Since: 1.10). EulerOrderRYXZ EulerOrder = 26 // EulerOrderRZXZ defines a relative rotation along the Z, X, and Z axes // (Since: 1.10). EulerOrderRZXZ EulerOrder = 27 // EulerOrderRXYZ defines a relative rotation along the X, Y, and Z axes // (Since: 1.10). EulerOrderRXYZ EulerOrder = 28 // EulerOrderRZYZ defines a relative rotation along the Z, Y, and Z axes // (Since: 1.10). EulerOrderRZYZ EulerOrder = 29 )
func (EulerOrder) String ¶
func (e EulerOrder) String() string
String returns the name in string for EulerOrder.
type Frustum ¶
type Frustum struct {
// contains filtered or unexported fields
}
Frustum: 3D volume delimited by 2D clip planes.
The contents of the graphene_frustum_t are private, and should not be modified directly.
An instance of this type is always passed by reference.
func (*Frustum) ContainsPoint ¶
ContainsPoint checks whether a point is inside the volume defined by the given #graphene_frustum_t.
The function takes the following parameters:
- point: #graphene_point3d_t.
The function returns the following values:
- ok: true if the point is inside the frustum.
func (*Frustum) Equal ¶
Equal checks whether the two given #graphene_frustum_t are equal.
The function takes the following parameters:
- b: #graphene_frustum_t.
The function returns the following values:
- ok: true if the given frustums are equal.
func (*Frustum) Init ¶
Init initializes the given #graphene_frustum_t using the provided clipping planes.
The function takes the following parameters:
- p0: clipping plane.
- p1: clipping plane.
- p2: clipping plane.
- p3: clipping plane.
- p4: clipping plane.
- p5: clipping plane.
The function returns the following values:
- frustum: initialized frustum.
func (*Frustum) InitFromFrustum ¶
InitFromFrustum initializes the given #graphene_frustum_t using the clipping planes of another #graphene_frustum_t.
The function takes the following parameters:
- src: #graphene_frustum_t.
The function returns the following values:
- frustum: initialized frustum.
func (*Frustum) InitFromMatrix ¶
InitFromMatrix initializes a #graphene_frustum_t using the given matrix.
The function takes the following parameters:
- matrix: #graphene_matrix_t.
The function returns the following values:
- frustum: initialized frustum.
func (*Frustum) IntersectsBox ¶
IntersectsBox checks whether the given box intersects a plane of a #graphene_frustum_t.
The function takes the following parameters:
- box: #graphene_box_t.
The function returns the following values:
- ok: true if the box intersects the frustum.
func (*Frustum) IntersectsSphere ¶
IntersectsSphere checks whether the given sphere intersects a plane of a #graphene_frustum_t.
The function takes the following parameters:
- sphere: #graphene_sphere_t.
The function returns the following values:
- ok: true if the sphere intersects the frustum.
type Matrix ¶
type Matrix struct {
// contains filtered or unexported fields
}
Matrix: structure capable of holding a 4x4 matrix.
The contents of the #graphene_matrix_t structure are private and should never be accessed directly.
An instance of this type is always passed by reference.
func (*Matrix) Decompose ¶
func (m *Matrix) Decompose() (translate *Vec3, scale *Vec3, rotate *Quaternion, shear *Vec3, perspective *Vec4, ok bool)
Decompose decomposes a transformation matrix into its component transformations.
The algorithm for decomposing a matrix is taken from the CSS3 Transforms specification (http://dev.w3.org/csswg/css-transforms/); specifically, the decomposition code is based on the equivalent code published in "Graphics Gems II", edited by Jim Arvo, and available online (http://tog.acm.org/resources/GraphicsGems/gemsii/unmatrix.c).
The function returns the following values:
- translate: translation vector.
- scale vector.
- rotate: rotation quaternion.
- shear vector.
- perspective vector.
- ok: true if the matrix could be decomposed.
func (*Matrix) Determinant ¶
Determinant computes the determinant of the given matrix.
The function returns the following values:
- gfloat: value of the determinant.
func (*Matrix) Equal ¶
Equal checks whether the two given #graphene_matrix_t matrices are equal.
The function takes the following parameters:
- b: #graphene_matrix_t.
The function returns the following values:
- ok: true if the two matrices are equal, and false otherwise.
func (*Matrix) EqualFast ¶
EqualFast checks whether the two given #graphene_matrix_t matrices are byte-by-byte equal.
While this function is faster than graphene_matrix_equal(), it can also return false negatives, so it should be used in conjuction with either graphene_matrix_equal() or graphene_matrix_near(). For instance:
if (graphene_matrix_equal_fast (a, b)) { // matrices are definitely the same } else { if (graphene_matrix_equal (a, b)) // matrices contain the same values within an epsilon of FLT_EPSILON else if (graphene_matrix_near (a, b, 0.0001)) // matrices contain the same values within an epsilon of 0.0001 else // matrices are not equal }.
The function takes the following parameters:
- b: #graphene_matrix_t.
The function returns the following values:
- ok: true if the matrices are equal. and false otherwise.
func (*Matrix) InitFrom2D ¶
func (m *Matrix) InitFrom2D(xx float64, yx float64, xy float64, yy float64, x0 float64, y0 float64) *Matrix
InitFrom2D initializes a #graphene_matrix_t from the values of an affine transformation matrix.
The arguments map to the following matrix layout:
⎛ xx yx ⎞ ⎛ a b 0 ⎞ ⎜ xy yy ⎟ = ⎜ c d 0 ⎟ ⎝ x0 y0 ⎠ ⎝ tx ty 1 ⎠
This function can be used to convert between an affine matrix type from other libraries and a #graphene_matrix_t.
The function takes the following parameters:
- xx member.
- yx member.
- xy member.
- yy member.
- x0 member.
- y0 member.
The function returns the following values:
- matrix: initialized matrix.
func (*Matrix) InitFromFloat ¶
InitFromFloat initializes a #graphene_matrix_t with the given array of floating point values.
The function takes the following parameters:
- v: array of at least 16 floating point values.
The function returns the following values:
- matrix: initialized matrix.
func (*Matrix) InitFromMatrix ¶
InitFromMatrix initializes a #graphene_matrix_t using the values of the given matrix.
The function takes the following parameters:
- src: #graphene_matrix_t.
The function returns the following values:
- matrix: initialized matrix.
func (*Matrix) InitFromVec4 ¶
InitFromVec4 initializes a #graphene_matrix_t with the given four row vectors.
The function takes the following parameters:
- v0: first row vector.
- v1: second row vector.
- v2: third row vector.
- v3: fourth row vector.
The function returns the following values:
- matrix: initialized matrix.
func (*Matrix) InitFrustum ¶
func (m *Matrix) InitFrustum(left float32, right float32, bottom float32, top float32, zNear float32, zFar float32) *Matrix
InitFrustum initializes a #graphene_matrix_t compatible with #graphene_frustum_t.
See also: graphene_frustum_init_from_matrix().
The function takes the following parameters:
- left: distance of the left clipping plane.
- right: distance of the right clipping plane.
- bottom: distance of the bottom clipping plane.
- top: distance of the top clipping plane.
- zNear: distance of the near clipping plane.
- zFar: distance of the far clipping plane.
The function returns the following values:
- matrix: initialized matrix.
func (*Matrix) InitIdentity ¶
InitIdentity initializes a #graphene_matrix_t with the identity matrix.
The function returns the following values:
- matrix: initialized matrix.
func (*Matrix) InitLookAt ¶
InitLookAt initializes a #graphene_matrix_t so that it positions the "camera" at the given eye coordinates towards an object at the center coordinates. The top of the camera is aligned to the direction of the up vector.
Before the transform, the camera is assumed to be placed at the origin, looking towards the negative Z axis, with the top side of the camera facing in the direction of the Y axis and the right side in the direction of the X axis.
In theory, one could use m to transform a model of such a camera into world-space. However, it is more common to use the inverse of m to transform another object from world coordinates to the view coordinates of the camera. Typically you would then apply the camera projection transform to get from view to screen coordinates.
The function takes the following parameters:
- eye: vector describing the position to look from.
- center: vector describing the position to look at.
- up: vector describing the world's upward direction; usually, this is the graphene_vec3_y_axis() vector.
The function returns the following values:
- matrix: initialized matrix.
func (*Matrix) InitOrtho ¶
func (m *Matrix) InitOrtho(left float32, right float32, top float32, bottom float32, zNear float32, zFar float32) *Matrix
InitOrtho initializes a #graphene_matrix_t with an orthographic projection.
The function takes the following parameters:
- left edge of the clipping plane.
- right edge of the clipping plane.
- top edge of the clipping plane.
- bottom edge of the clipping plane.
- zNear: distance of the near clipping plane.
- zFar: distance of the far clipping plane.
The function returns the following values:
- matrix: initialized matrix.
func (*Matrix) InitPerspective ¶
InitPerspective initializes a #graphene_matrix_t with a perspective projection.
The function takes the following parameters:
- fovy: field of view angle, in degrees.
- aspect value.
- zNear: near Z plane.
- zFar: far Z plane.
The function returns the following values:
- matrix: initialized matrix.
func (*Matrix) InitRotate ¶
InitRotate initializes m to represent a rotation of angle degrees on the axis represented by the axis vector.
The function takes the following parameters:
- angle: rotation angle, in degrees.
- axis vector as a #graphene_vec3_t.
The function returns the following values:
- matrix: initialized matrix.
func (*Matrix) InitScale ¶
InitScale initializes a #graphene_matrix_t with the given scaling factors.
The function takes the following parameters:
- x: scale factor on the X axis.
- y: scale factor on the Y axis.
- z: scale factor on the Z axis.
The function returns the following values:
- matrix: initialized matrix.
func (*Matrix) InitSkew ¶
InitSkew initializes a #graphene_matrix_t with a skew transformation with the given factors.
The function takes the following parameters:
- xSkew: skew factor, in radians, on the X axis.
- ySkew: skew factor, in radians, on the Y axis.
The function returns the following values:
- matrix: initialized matrix.
func (*Matrix) InitTranslate ¶
InitTranslate initializes a #graphene_matrix_t with a translation to the given coordinates.
The function takes the following parameters:
- p: translation coordinates.
The function returns the following values:
- matrix: initialized matrix.
func (*Matrix) Interpolate ¶
Interpolate: linearly interpolates the two given #graphene_matrix_t by interpolating the decomposed transformations separately.
If either matrix cannot be reduced to their transformations then the interpolation cannot be performed, and this function will return an identity matrix.
The function takes the following parameters:
- b: #graphene_matrix_t.
- factor: linear interpolation factor.
The function returns the following values:
- res: return location for the interpolated matrix.
func (*Matrix) Inverse ¶
Inverse inverts the given matrix.
The function returns the following values:
- res: return location for the inverse matrix.
- ok: true if the matrix is invertible.
func (*Matrix) Is2D ¶
Is2D checks whether the given #graphene_matrix_t is compatible with an a 2D affine transformation matrix.
The function returns the following values:
- ok: true if the matrix is compatible with an affine transformation matrix.
func (*Matrix) IsBackfaceVisible ¶
IsBackfaceVisible checks whether a #graphene_matrix_t has a visible back face.
The function returns the following values:
- ok: true if the back face of the matrix is visible.
func (*Matrix) IsIdentity ¶
IsIdentity checks whether the given #graphene_matrix_t is the identity matrix.
The function returns the following values:
- ok: true if the matrix is the identity matrix.
func (*Matrix) IsSingular ¶
IsSingular checks whether a matrix is singular.
The function returns the following values:
- ok: true if the matrix is singular.
func (*Matrix) Multiply ¶
Multiply multiplies two #graphene_matrix_t.
Matrix multiplication is not commutative in general; the order of the factors matters. The product of this multiplication is (a × b).
The function takes the following parameters:
- b: #graphene_matrix_t.
The function returns the following values:
- res: return location for the matrix result.
func (*Matrix) Near ¶
Near compares the two given #graphene_matrix_t matrices and checks whether their values are within the given epsilon of each other.
The function takes the following parameters:
- b: #graphene_matrix_t.
- epsilon: threshold between the two matrices.
The function returns the following values:
- ok: true if the two matrices are near each other, and false otherwise.
func (*Matrix) Normalize ¶
Normalize normalizes the given #graphene_matrix_t.
The function returns the following values:
- res: return location for the normalized matrix.
func (*Matrix) Perspective ¶
Perspective applies a perspective of depth to the matrix.
The function takes the following parameters:
- depth of the perspective.
The function returns the following values:
- res: return location for the perspective matrix.
func (*Matrix) Print ¶
func (m *Matrix) Print()
Print prints the contents of a matrix to the standard error stream.
This function is only useful for debugging; there are no guarantees made on the format of the output.
func (*Matrix) ProjectPoint ¶
ProjectPoint projects a #graphene_point_t using the matrix m.
The function takes the following parameters:
- p: #graphene_point_t.
The function returns the following values:
- res: return location for the projected point.
func (*Matrix) ProjectRect ¶
ProjectRect projects all corners of a #graphene_rect_t using the given matrix.
See also: graphene_matrix_project_point().
The function takes the following parameters:
- r: #graphene_rect_t.
The function returns the following values:
- res: return location for the projected rectangle.
func (*Matrix) ProjectRectBounds ¶
ProjectRectBounds projects a #graphene_rect_t using the given matrix.
The resulting rectangle is the axis aligned bounding rectangle capable of fully containing the projected rectangle.
The function takes the following parameters:
- r: #graphene_rect_t.
The function returns the following values:
- res: return location for the projected rectangle.
func (*Matrix) Rotate ¶
Rotate adds a rotation transformation to m, using the given angle and axis vector.
This is the equivalent of calling graphene_matrix_init_rotate() and then multiplying the matrix m with the rotation matrix.
The function takes the following parameters:
- angle: rotation angle, in degrees.
- axis: rotation axis, as a #graphene_vec3_t.
func (*Matrix) RotateEuler ¶
RotateEuler adds a rotation transformation to m, using the given #graphene_euler_t.
The function takes the following parameters:
- e: rotation described by a #graphene_euler_t.
func (*Matrix) RotateQuaternion ¶
func (m *Matrix) RotateQuaternion(q *Quaternion)
RotateQuaternion adds a rotation transformation to m, using the given #graphene_quaternion_t.
This is the equivalent of calling graphene_quaternion_to_matrix() and then multiplying m with the rotation matrix.
The function takes the following parameters:
- q: rotation described by a #graphene_quaternion_t.
func (*Matrix) RotateX ¶
RotateX adds a rotation transformation around the X axis to m, using the given angle.
See also: graphene_matrix_rotate().
The function takes the following parameters:
- angle: rotation angle, in degrees.
func (*Matrix) RotateY ¶
RotateY adds a rotation transformation around the Y axis to m, using the given angle.
See also: graphene_matrix_rotate().
The function takes the following parameters:
- angle: rotation angle, in degrees.
func (*Matrix) RotateZ ¶
RotateZ adds a rotation transformation around the Z axis to m, using the given angle.
See also: graphene_matrix_rotate().
The function takes the following parameters:
- angle: rotation angle, in degrees.
func (*Matrix) Row ¶
Row retrieves the given row vector at index_ inside a matrix.
The function takes the following parameters:
- index_: index of the row vector, between 0 and 3.
The function returns the following values:
- res: return location for the #graphene_vec4_t that is used to store the row vector.
func (*Matrix) Scale ¶
Scale adds a scaling transformation to m, using the three given factors.
This is the equivalent of calling graphene_matrix_init_scale() and then multiplying the matrix m with the scale matrix.
The function takes the following parameters:
- factorX: scaling factor on the X axis.
- factorY: scaling factor on the Y axis.
- factorZ: scaling factor on the Z axis.
func (*Matrix) SkewXY ¶
SkewXY adds a skew of factor on the X and Y axis to the given matrix.
The function takes the following parameters:
- factor: skew factor.
func (*Matrix) SkewXZ ¶
SkewXZ adds a skew of factor on the X and Z axis to the given matrix.
The function takes the following parameters:
- factor: skew factor.
func (*Matrix) SkewYZ ¶
SkewYZ adds a skew of factor on the Y and Z axis to the given matrix.
The function takes the following parameters:
- factor: skew factor.
func (*Matrix) To2D ¶
func (m *Matrix) To2D() (xx float64, yx float64, xy float64, yy float64, x0 float64, y0 float64, ok bool)
To2D converts a #graphene_matrix_t to an affine transformation matrix, if the given matrix is compatible.
The returned values have the following layout:
⎛ xx yx ⎞ ⎛ a b 0 ⎞ ⎜ xy yy ⎟ = ⎜ c d 0 ⎟ ⎝ x0 y0 ⎠ ⎝ tx ty 1 ⎠
This function can be used to convert between a #graphene_matrix_t and an affine matrix type from other libraries.
The function returns the following values:
- xx: return location for the xx member.
- yx: return location for the yx member.
- xy: return location for the xy member.
- yy: return location for the yy member.
- x0: return location for the x0 member.
- y0: return location for the y0 member.
- ok: true if the matrix is compatible with an affine transformation matrix.
func (*Matrix) ToFloat ¶
ToFloat converts a #graphene_matrix_t to an array of floating point values.
The function returns the following values:
- v: return location for an array of floating point values. The array must be capable of holding at least 16 values.
func (*Matrix) TransformBounds ¶
TransformBounds transforms each corner of a #graphene_rect_t using the given matrix m.
The result is the axis aligned bounding rectangle containing the coplanar quadrilateral.
See also: graphene_matrix_transform_point().
The function takes the following parameters:
- r: #graphene_rect_t.
The function returns the following values:
- res: return location for the bounds of the transformed rectangle.
func (*Matrix) TransformBox ¶
TransformBox transforms the vertices of a #graphene_box_t using the given matrix m.
The result is the axis aligned bounding box containing the transformed vertices.
The function takes the following parameters:
- b: #graphene_box_t.
The function returns the following values:
- res: return location for the bounds of the transformed box.
func (*Matrix) TransformPoint ¶
TransformPoint transforms the given #graphene_point_t using the matrix m.
Unlike graphene_matrix_transform_vec3(), this function will take into account the fourth row vector of the #graphene_matrix_t when computing the dot product of each row vector of the matrix.
See also: graphene_simd4x4f_point3_mul().
The function takes the following parameters:
- p: #graphene_point_t.
The function returns the following values:
- res: return location for the transformed #graphene_point_t.
func (*Matrix) TransformPoint3D ¶
TransformPoint3D transforms the given #graphene_point3d_t using the matrix m.
Unlike graphene_matrix_transform_vec3(), this function will take into account the fourth row vector of the #graphene_matrix_t when computing the dot product of each row vector of the matrix.
See also: graphene_simd4x4f_point3_mul().
The function takes the following parameters:
- p: #graphene_point3d_t.
The function returns the following values:
- res: return location for the result.
func (*Matrix) TransformRay ¶
TransformRay: transform a #graphene_ray_t using the given matrix m.
The function takes the following parameters:
- r: #graphene_ray_t.
The function returns the following values:
- res: return location for the transformed ray.
func (*Matrix) TransformRect ¶
TransformRect transforms each corner of a #graphene_rect_t using the given matrix m.
The result is a coplanar quadrilateral.
See also: graphene_matrix_transform_point().
The function takes the following parameters:
- r: #graphene_rect_t.
The function returns the following values:
- res: return location for the transformed quad.
func (*Matrix) TransformSphere ¶
TransformSphere transforms a #graphene_sphere_t using the given matrix m. The result is the bounding sphere containing the transformed sphere.
The function takes the following parameters:
- s: #graphene_sphere_t.
The function returns the following values:
- res: return location for the bounds of the transformed sphere.
func (*Matrix) TransformVec3 ¶
TransformVec3 transforms the given #graphene_vec3_t using the matrix m.
This function will multiply the X, Y, and Z row vectors of the matrix m with the corresponding components of the vector v. The W row vector will be ignored.
See also: graphene_simd4x4f_vec3_mul().
The function takes the following parameters:
- v: #graphene_vec3_t.
The function returns the following values:
- res: return location for a #graphene_vec3_t.
func (*Matrix) TransformVec4 ¶
TransformVec4 transforms the given #graphene_vec4_t using the matrix m.
See also: graphene_simd4x4f_vec4_mul().
The function takes the following parameters:
- v: #graphene_vec4_t.
The function returns the following values:
- res: return location for a #graphene_vec4_t.
func (*Matrix) Translate ¶
Translate adds a translation transformation to m using the coordinates of the given #graphene_point3d_t.
This is the equivalent of calling graphene_matrix_init_translate() and then multiplying m with the translation matrix.
The function takes the following parameters:
- pos: #graphene_point3d_t.
func (*Matrix) Transpose ¶
Transpose transposes the given matrix.
The function returns the following values:
- res: return location for the transposed matrix.
func (*Matrix) UnprojectPoint3D ¶
UnprojectPoint3D unprojects the given point using the projection matrix and a modelview matrix.
The function takes the following parameters:
- modelview for the modelview matrix; this is the inverse of the modelview used when projecting the point.
- point with the coordinates of the point.
The function returns the following values:
- res: return location for the unprojected point.
func (*Matrix) UntransformBounds ¶
UntransformBounds undoes the transformation on the corners of a #graphene_rect_t using the given matrix, within the given axis aligned rectangular bounds.
The function takes the following parameters:
- r: #graphene_rect_t.
- bounds of the transformation.
The function returns the following values:
- res: return location for the untransformed rectangle.
func (*Matrix) UntransformPoint ¶
UntransformPoint undoes the transformation of a #graphene_point_t using the given matrix, within the given axis aligned rectangular bounds.
The function takes the following parameters:
- p: #graphene_point_t.
- bounds of the transformation.
The function returns the following values:
- res: return location for the untransformed point.
- ok: true if the point was successfully untransformed.
func (*Matrix) Value ¶
Value retrieves the value at the given row and col index.
The function takes the following parameters:
- row index.
- col: column index.
The function returns the following values:
- gfloat: value at the given indices.
func (*Matrix) XScale ¶
XScale retrieves the scaling factor on the X axis in m.
The function returns the following values:
- gfloat: value of the scaling factor.
func (*Matrix) XTranslation ¶
XTranslation retrieves the translation component on the X axis from m.
The function returns the following values:
- gfloat: translation component.
func (*Matrix) YScale ¶
YScale retrieves the scaling factor on the Y axis in m.
The function returns the following values:
- gfloat: value of the scaling factor.
func (*Matrix) YTranslation ¶
YTranslation retrieves the translation component on the Y axis from m.
The function returns the following values:
- gfloat: translation component.
func (*Matrix) ZScale ¶
ZScale retrieves the scaling factor on the Z axis in m.
The function returns the following values:
- gfloat: value of the scaling factor.
func (*Matrix) ZTranslation ¶
ZTranslation retrieves the translation component on the Z axis from m.
The function returns the following values:
- gfloat: translation component.
type Plane ¶
type Plane struct {
// contains filtered or unexported fields
}
Plane: 2D plane that extends infinitely in a 3D volume.
The contents of the graphene_plane_t are private, and should not be modified directly.
An instance of this type is always passed by reference.
func (*Plane) Constant ¶
Constant retrieves the distance along the normal vector of the given #graphene_plane_t from the origin.
The function returns the following values:
- gfloat: constant value of the plane.
func (*Plane) Distance ¶
Distance computes the distance of point from a #graphene_plane_t.
The function takes the following parameters:
- point: #graphene_point3d_t.
The function returns the following values:
- gfloat: distance of the given #graphene_point3d_t from the plane.
func (*Plane) Equal ¶
Equal checks whether the two given #graphene_plane_t are equal.
The function takes the following parameters:
- b: #graphene_plane_t.
The function returns the following values:
- ok: true if the given planes are equal.
func (*Plane) Init ¶
Init initializes the given #graphene_plane_t using the given normal vector and constant values.
The function takes the following parameters:
- normal (optional): unit length normal vector defining the plane pointing towards the origin; if unset, we use the X axis by default.
- constant: distance from the origin to the plane along the normal vector; the sign determines the half-space occupied by the plane.
The function returns the following values:
- plane: initialized plane.
func (*Plane) InitFromPlane ¶
InitFromPlane initializes the given #graphene_plane_t using the normal vector and constant of another #graphene_plane_t.
The function takes the following parameters:
- src: #graphene_plane_t.
The function returns the following values:
- plane: initialized plane.
func (*Plane) InitFromPoint ¶
InitFromPoint initializes the given #graphene_plane_t using the given normal vector and an arbitrary co-planar point.
The function takes the following parameters:
- normal vector defining the plane pointing towards the origin.
- point: #graphene_point3d_t.
The function returns the following values:
- plane: initialized plane.
func (*Plane) InitFromPoints ¶
InitFromPoints initializes the given #graphene_plane_t using the 3 provided co-planar points.
The winding order is counter-clockwise, and determines which direction the normal vector will point.
The function takes the following parameters:
- a: #graphene_point3d_t.
- b: #graphene_point3d_t.
- c: #graphene_point3d_t.
The function returns the following values:
- plane: initialized plane.
func (*Plane) InitFromVec4 ¶
InitFromVec4 initializes the given #graphene_plane_t using the components of the given #graphene_vec4_t vector.
The function takes the following parameters:
- src containing the normal vector in its first three components, and the distance in its fourth component.
The function returns the following values:
- plane: initialized plane.
func (*Plane) Negate ¶
Negate negates the normal vector and constant of a #graphene_plane_t, effectively mirroring the plane across the origin.
The function returns the following values:
- res: return location for the negated plane.
func (*Plane) Normal ¶
Normal retrieves the normal vector pointing towards the origin of the given #graphene_plane_t.
The function returns the following values:
- normal: return location for the normal vector.
func (*Plane) Normalize ¶
Normalize normalizes the vector of the given #graphene_plane_t, and adjusts the constant accordingly.
The function returns the following values:
- res: return location for the normalized plane.
func (*Plane) Transform ¶
Transform transforms a #graphene_plane_t p using the given matrix and normal_matrix.
If normal_matrix is NULL, a transformation matrix for the plane normal will be computed from matrix. If you are transforming multiple planes using the same matrix it's recommended to compute the normal matrix beforehand to avoid incurring in the cost of recomputing it every time.
The function takes the following parameters:
- matrix: #graphene_matrix_t.
- normalMatrix (optional): #graphene_matrix_t.
The function returns the following values:
- res: transformed plane.
type Point ¶
type Point struct {
// contains filtered or unexported fields
}
Point: point with two coordinates.
An instance of this type is always passed by reference.
func PointZero ¶
func PointZero() *Point
PointZero returns a point fixed at (0, 0).
The function returns the following values:
- point: fixed point.
func (*Point) Distance ¶
Distance computes the distance between a and b.
The function takes the following parameters:
- b: #graphene_point_t.
The function returns the following values:
- dX (optional): distance component on the X axis.
- dY (optional): distance component on the Y axis.
- gfloat: distance between the two points.
func (*Point) Equal ¶
Equal checks if the two points a and b point to the same coordinates.
This function accounts for floating point fluctuations; if you want to control the fuzziness of the match, you can use graphene_point_near() instead.
The function takes the following parameters:
- b: #graphene_point_t.
The function returns the following values:
- ok: true if the points have the same coordinates.
func (*Point) Init ¶
Init initializes p to the given x and y coordinates.
It's safe to call this function multiple times.
The function takes the following parameters:
- x: x coordinate.
- y: y coordinate.
The function returns the following values:
- point: initialized point.
func (*Point) InitFromPoint ¶
InitFromPoint initializes p with the same coordinates of src.
The function takes the following parameters:
- src to use.
The function returns the following values:
- point: initialized point.
func (*Point) InitFromVec2 ¶
InitFromVec2 initializes p with the coordinates inside the given #graphene_vec2_t.
The function takes the following parameters:
- src: #graphene_vec2_t.
The function returns the following values:
- point: initialized point.
func (*Point) Interpolate ¶
Interpolate: linearly interpolates the coordinates of a and b using the given factor.
The function takes the following parameters:
- b: #graphene_point_t.
- factor: linear interpolation factor.
The function returns the following values:
- res: return location for the interpolated point.
func (*Point) Near ¶
Near checks whether the two points a and b are within the threshold of epsilon.
The function takes the following parameters:
- b: #graphene_point_t.
- epsilon: threshold between the two points.
The function returns the following values:
- ok: true if the distance is within epsilon.
type Point3D ¶
type Point3D struct {
// contains filtered or unexported fields
}
Point3D: point with three components: X, Y, and Z.
An instance of this type is always passed by reference.
func Point3DZero ¶
func Point3DZero() *Point3D
Point3DZero retrieves a constant point with all three coordinates set to 0.
The function returns the following values:
- point3D: zero point.
func (*Point3D) Cross ¶
Cross computes the cross product of the two given #graphene_point3d_t.
The function takes the following parameters:
- b: #graphene_point3d_t.
The function returns the following values:
- res: return location for the cross product.
func (*Point3D) Distance ¶
Distance computes the distance between the two given #graphene_point3d_t.
The function takes the following parameters:
- b: #graphene_point3d_t.
The function returns the following values:
- delta (optional): return location for the distance components on the X, Y, and Z axis.
- gfloat: distance between two points.
func (*Point3D) Dot ¶
Dot computes the dot product of the two given #graphene_point3d_t.
The function takes the following parameters:
- b: #graphene_point3d_t.
The function returns the following values:
- gfloat: value of the dot product.
func (*Point3D) Equal ¶
Equal checks whether two given points are equal.
The function takes the following parameters:
- b: #graphene_point3d_t.
The function returns the following values:
- ok: true if the points are equal.
func (*Point3D) Init ¶
Init initializes a #graphene_point3d_t with the given coordinates.
The function takes the following parameters:
- x: x coordinate of the point.
- y: y coordinate of the point.
- z: z coordinate of the point.
The function returns the following values:
- point3D: initialized #graphene_point3d_t.
func (*Point3D) InitFromPoint ¶
InitFromPoint initializes a #graphene_point3d_t using the coordinates of another #graphene_point3d_t.
The function takes the following parameters:
- src: #graphene_point3d_t.
The function returns the following values:
- point3D: initialized point.
func (*Point3D) InitFromVec3 ¶
InitFromVec3 initializes a #graphene_point3d_t using the components of a #graphene_vec3_t.
The function takes the following parameters:
- v: #graphene_vec3_t.
The function returns the following values:
- point3D: initialized #graphene_point3d_t.
func (*Point3D) Interpolate ¶
Interpolate: linearly interpolates each component of a and b using the provided factor, and places the result in res.
The function takes the following parameters:
- b: #graphene_point3d_t.
- factor: interpolation factor.
The function returns the following values:
- res: return location for the interpolated #graphene_point3d_t.
func (*Point3D) Length ¶
Length computes the length of the vector represented by the coordinates of the given #graphene_point3d_t.
The function returns the following values:
- gfloat: length of the vector represented by the point.
func (*Point3D) Near ¶
Near checks whether the two points are near each other, within an epsilon factor.
The function takes the following parameters:
- b: #graphene_point3d_t.
- epsilon fuzzyness factor.
The function returns the following values:
- ok: true if the points are near each other.
func (*Point3D) Normalize ¶
Normalize computes the normalization of the vector represented by the coordinates of the given #graphene_point3d_t.
The function returns the following values:
- res: return location for the normalized #graphene_point3d_t.
func (*Point3D) NormalizeViewport ¶
NormalizeViewport normalizes the coordinates of a #graphene_point3d_t using the given viewport and clipping planes.
The coordinates of the resulting #graphene_point3d_t will be in the [ -1, 1 ] range.
The function takes the following parameters:
- viewport representing a viewport.
- zNear: coordinate of the near clipping plane, or 0 for the default near clipping plane.
- zFar: coordinate of the far clipping plane, or 1 for the default far clipping plane.
The function returns the following values:
- res: return location for the normalized #graphene_point3d_t.
func (*Point3D) Scale ¶
Scale scales the coordinates of the given #graphene_point3d_t by the given factor.
The function takes the following parameters:
- factor: scaling factor.
The function returns the following values:
- res: return location for the scaled point.
type Quad ¶
type Quad struct {
// contains filtered or unexported fields
}
Quad: 4 vertex quadrilateral, as represented by four #graphene_point_t.
The contents of a #graphene_quad_t are private and should never be accessed directly.
An instance of this type is always passed by reference.
func (*Quad) Bounds ¶
Bounds computes the bounding rectangle of q and places it into r.
The function returns the following values:
- r: return location for a #graphene_rect_t.
func (*Quad) Contains ¶
Contains checks if the given #graphene_quad_t contains the given #graphene_point_t.
The function takes the following parameters:
- p: #graphene_point_t.
The function returns the following values:
- ok: true if the point is inside the #graphene_quad_t.
func (*Quad) Init ¶
Init initializes a #graphene_quad_t with the given points.
The function takes the following parameters:
- p1: first point of the quadrilateral.
- p2: second point of the quadrilateral.
- p3: third point of the quadrilateral.
- p4: fourth point of the quadrilateral.
The function returns the following values:
- quad: initialized #graphene_quad_t.
func (*Quad) InitFromPoints ¶
InitFromPoints initializes a #graphene_quad_t using an array of points.
The function takes the following parameters:
- points: array of 4 #graphene_point_t.
The function returns the following values:
- quad: initialized #graphene_quad_t.
func (*Quad) InitFromRect ¶
InitFromRect initializes a #graphene_quad_t using the four corners of the given #graphene_rect_t.
The function takes the following parameters:
- r: #graphene_rect_t.
The function returns the following values:
- quad: initialized #graphene_quad_t.
type Quaternion ¶
type Quaternion struct {
// contains filtered or unexported fields
}
Quaternion: quaternion.
The contents of the #graphene_quaternion_t structure are private and should never be accessed directly.
An instance of this type is always passed by reference.
func NewQuaternionAlloc ¶
func NewQuaternionAlloc() *Quaternion
NewQuaternionAlloc constructs a struct Quaternion.
func (*Quaternion) Add ¶
func (a *Quaternion) Add(b *Quaternion) *Quaternion
Add adds two #graphene_quaternion_t a and b.
The function takes the following parameters:
- b: #graphene_quaternion_t.
The function returns the following values:
- res: result of the operation.
func (*Quaternion) Dot ¶
func (a *Quaternion) Dot(b *Quaternion) float32
Dot computes the dot product of two #graphene_quaternion_t.
The function takes the following parameters:
- b: #graphene_quaternion_t.
The function returns the following values:
- gfloat: value of the dot products.
func (*Quaternion) Equal ¶
func (a *Quaternion) Equal(b *Quaternion) bool
Equal checks whether the given quaternions are equal.
The function takes the following parameters:
- b: #graphene_quaternion_t.
The function returns the following values:
- ok: true if the quaternions are equal.
func (*Quaternion) Init ¶
func (q *Quaternion) Init(x float32, y float32, z float32, w float32) *Quaternion
Init initializes a #graphene_quaternion_t using the given four values.
The function takes the following parameters:
- x: first component of the quaternion.
- y: second component of the quaternion.
- z: third component of the quaternion.
- w: fourth component of the quaternion.
The function returns the following values:
- quaternion: initialized quaternion.
func (*Quaternion) InitFromAngleVec3 ¶
func (q *Quaternion) InitFromAngleVec3(angle float32, axis *Vec3) *Quaternion
InitFromAngleVec3 initializes a #graphene_quaternion_t using an angle on a specific axis.
The function takes the following parameters:
- angle: rotation on a given axis, in degrees.
- axis of rotation, expressed as a vector.
The function returns the following values:
- quaternion: initialized quaternion.
func (*Quaternion) InitFromAngles ¶
func (q *Quaternion) InitFromAngles(degX float32, degY float32, degZ float32) *Quaternion
InitFromAngles initializes a #graphene_quaternion_t using the values of the Euler angles (http://en.wikipedia.org/wiki/Euler_angles) on each axis.
See also: graphene_quaternion_init_from_euler().
The function takes the following parameters:
- degX: rotation angle on the X axis (yaw), in degrees.
- degY: rotation angle on the Y axis (pitch), in degrees.
- degZ: rotation angle on the Z axis (roll), in degrees.
The function returns the following values:
- quaternion: initialized quaternion.
func (*Quaternion) InitFromEuler ¶
func (q *Quaternion) InitFromEuler(e *Euler) *Quaternion
InitFromEuler initializes a #graphene_quaternion_t using the given #graphene_euler_t.
The function takes the following parameters:
- e: #graphene_euler_t.
The function returns the following values:
- quaternion: initialized #graphene_quaternion_t.
func (*Quaternion) InitFromMatrix ¶
func (q *Quaternion) InitFromMatrix(m *Matrix) *Quaternion
InitFromMatrix initializes a #graphene_quaternion_t using the rotation components of a transformation matrix.
The function takes the following parameters:
- m: #graphene_matrix_t.
The function returns the following values:
- quaternion: initialized quaternion.
func (*Quaternion) InitFromQuaternion ¶
func (q *Quaternion) InitFromQuaternion(src *Quaternion) *Quaternion
InitFromQuaternion initializes a #graphene_quaternion_t with the values from src.
The function takes the following parameters:
- src: #graphene_quaternion_t.
The function returns the following values:
- quaternion: initialized quaternion.
func (*Quaternion) InitFromRadians ¶
func (q *Quaternion) InitFromRadians(radX float32, radY float32, radZ float32) *Quaternion
InitFromRadians initializes a #graphene_quaternion_t using the values of the Euler angles (http://en.wikipedia.org/wiki/Euler_angles) on each axis.
See also: graphene_quaternion_init_from_euler().
The function takes the following parameters:
- radX: rotation angle on the X axis (yaw), in radians.
- radY: rotation angle on the Y axis (pitch), in radians.
- radZ: rotation angle on the Z axis (roll), in radians.
The function returns the following values:
- quaternion: initialized quaternion.
func (*Quaternion) InitFromVec4 ¶
func (q *Quaternion) InitFromVec4(src *Vec4) *Quaternion
InitFromVec4 initializes a #graphene_quaternion_t with the values from src.
The function takes the following parameters:
- src: #graphene_vec4_t.
The function returns the following values:
- quaternion: initialized quaternion.
func (*Quaternion) InitIdentity ¶
func (q *Quaternion) InitIdentity() *Quaternion
InitIdentity initializes a #graphene_quaternion_t using the identity transformation.
The function returns the following values:
- quaternion: initialized quaternion.
func (*Quaternion) Invert ¶
func (q *Quaternion) Invert() *Quaternion
Invert inverts a #graphene_quaternion_t, and returns the conjugate quaternion of q.
The function returns the following values:
- res: return location for the inverted quaternion.
func (*Quaternion) Multiply ¶
func (a *Quaternion) Multiply(b *Quaternion) *Quaternion
Multiply multiplies two #graphene_quaternion_t a and b.
The function takes the following parameters:
- b: #graphene_quaternion_t.
The function returns the following values:
- res: result of the operation.
func (*Quaternion) Normalize ¶
func (q *Quaternion) Normalize() *Quaternion
Normalize normalizes a #graphene_quaternion_t.
The function returns the following values:
- res: return location for the normalized quaternion.
func (*Quaternion) Scale ¶
func (q *Quaternion) Scale(factor float32) *Quaternion
Scale scales all the elements of a #graphene_quaternion_t q using the given scalar factor.
The function takes the following parameters:
- factor: scaling factor.
The function returns the following values:
- res: result of the operation.
func (*Quaternion) Slerp ¶
func (a *Quaternion) Slerp(b *Quaternion, factor float32) *Quaternion
Slerp interpolates between the two given quaternions using a spherical linear interpolation, or SLERP (http://en.wikipedia.org/wiki/Slerp), using the given interpolation factor.
The function takes the following parameters:
- b: #graphene_quaternion_t.
- factor: linear interpolation factor.
The function returns the following values:
- res: return location for the interpolated quaternion.
func (*Quaternion) ToAngleVec3 ¶
func (q *Quaternion) ToAngleVec3() (float32, *Vec3)
ToAngleVec3 converts a quaternion into an angle, axis pair.
The function returns the following values:
- angle: return location for the angle, in degrees.
- axis: return location for the rotation axis.
func (*Quaternion) ToAngles ¶
func (q *Quaternion) ToAngles() (degX float32, degY float32, degZ float32)
ToAngles converts a #graphene_quaternion_t to its corresponding rotations on the Euler angles (http://en.wikipedia.org/wiki/Euler_angles) on each axis.
The function returns the following values:
- degX (optional): return location for the rotation angle on the X axis (yaw), in degrees.
- degY (optional): return location for the rotation angle on the Y axis (pitch), in degrees.
- degZ (optional): return location for the rotation angle on the Z axis (roll), in degrees.
func (*Quaternion) ToMatrix ¶
func (q *Quaternion) ToMatrix() *Matrix
ToMatrix converts a quaternion into a transformation matrix expressing the rotation defined by the #graphene_quaternion_t.
The function returns the following values:
- m: #graphene_matrix_t.
func (*Quaternion) ToRadians ¶
func (q *Quaternion) ToRadians() (radX float32, radY float32, radZ float32)
ToRadians converts a #graphene_quaternion_t to its corresponding rotations on the Euler angles (http://en.wikipedia.org/wiki/Euler_angles) on each axis.
The function returns the following values:
- radX (optional): return location for the rotation angle on the X axis (yaw), in radians.
- radY (optional): return location for the rotation angle on the Y axis (pitch), in radians.
- radZ (optional): return location for the rotation angle on the Z axis (roll), in radians.
func (*Quaternion) ToVec4 ¶
func (q *Quaternion) ToVec4() *Vec4
ToVec4 copies the components of a #graphene_quaternion_t into a #graphene_vec4_t.
The function returns the following values:
- res: return location for a #graphene_vec4_t.
type Ray ¶
type Ray struct {
// contains filtered or unexported fields
}
Ray: ray emitted from an origin in a given direction.
The contents of the graphene_ray_t structure are private, and should not be modified directly.
An instance of this type is always passed by reference.
func (*Ray) ClosestPointToPoint ¶
ClosestPointToPoint computes the point on the given #graphene_ray_t that is closest to the given point p.
The function takes the following parameters:
- p: #graphene_point3d_t.
The function returns the following values:
- res: return location for the closest point3d.
func (*Ray) Direction ¶
Direction retrieves the direction of the given #graphene_ray_t.
The function returns the following values:
- direction: return location for the direction.
func (*Ray) DistanceToPlane ¶
DistanceToPlane computes the distance of the origin of the given #graphene_ray_t from the given plane.
If the ray does not intersect the plane, this function returns INFINITY.
The function takes the following parameters:
- p: #graphene_plane_t.
The function returns the following values:
- gfloat: distance of the origin of the ray from the plane.
func (*Ray) DistanceToPoint ¶
DistanceToPoint computes the distance of the closest approach between the given #graphene_ray_t r and the point p.
The closest approach to a ray from a point is the distance between the point and the projection of the point on the ray itself.
The function takes the following parameters:
- p: #graphene_point3d_t.
The function returns the following values:
- gfloat: distance of the point.
func (*Ray) Equal ¶
Equal checks whether the two given #graphene_ray_t are equal.
The function takes the following parameters:
- b: #graphene_ray_t.
The function returns the following values:
- ok: true if the given rays are equal.
func (*Ray) Init ¶
Init initializes the given #graphene_ray_t using the given origin and direction values.
The function takes the following parameters:
- origin (optional) of the ray.
- direction (optional) vector.
The function returns the following values:
- ray: initialized ray.
func (*Ray) InitFromRay ¶
InitFromRay initializes the given #graphene_ray_t using the origin and direction values of another #graphene_ray_t.
The function takes the following parameters:
- src: #graphene_ray_t.
The function returns the following values:
- ray: initialized ray.
func (*Ray) InitFromVec3 ¶
InitFromVec3 initializes the given #graphene_ray_t using the given vectors.
The function takes the following parameters:
- origin (optional): #graphene_vec3_t.
- direction (optional): #graphene_vec3_t.
The function returns the following values:
- ray: initialized ray.
func (*Ray) IntersectBox ¶
func (r *Ray) IntersectBox(b *Box) (float32, RayIntersectionKind)
IntersectBox intersects the given #graphene_ray_t r with the given #graphene_box_t b.
The function takes the following parameters:
- b: #graphene_box_t.
The function returns the following values:
- tOut: distance of the point on the ray that intersects the box.
- rayIntersectionKind: type of intersection.
func (*Ray) IntersectSphere ¶
func (r *Ray) IntersectSphere(s *Sphere) (float32, RayIntersectionKind)
IntersectSphere intersects the given #graphene_ray_t r with the given #graphene_sphere_t s.
The function takes the following parameters:
- s: #graphene_sphere_t.
The function returns the following values:
- tOut: distance of the point on the ray that intersects the sphere.
- rayIntersectionKind: type of intersection.
func (*Ray) IntersectTriangle ¶
func (r *Ray) IntersectTriangle(t *Triangle) (float32, RayIntersectionKind)
IntersectTriangle intersects the given #graphene_ray_t r with the given #graphene_triangle_t t.
The function takes the following parameters:
- t: #graphene_triangle_t.
The function returns the following values:
- tOut: distance of the point on the ray that intersects the triangle.
- rayIntersectionKind: type of intersection.
func (*Ray) IntersectsBox ¶
IntersectsBox checks whether the given #graphene_ray_t r intersects the given #graphene_box_t b.
See also: graphene_ray_intersect_box().
The function takes the following parameters:
- b: #graphene_box_t.
The function returns the following values:
- ok: true if the ray intersects the box.
func (*Ray) IntersectsSphere ¶
IntersectsSphere checks if the given #graphene_ray_t r intersects the given #graphene_sphere_t s.
See also: graphene_ray_intersect_sphere().
The function takes the following parameters:
- s: #graphene_sphere_t.
The function returns the following values:
- ok: true if the ray intersects the sphere.
func (*Ray) IntersectsTriangle ¶
IntersectsTriangle checks whether the given #graphene_ray_t r intersects the given #graphene_triangle_t b.
See also: graphene_ray_intersect_triangle().
The function takes the following parameters:
- t: #graphene_triangle_t.
The function returns the following values:
- ok: true if the ray intersects the triangle.
func (*Ray) Origin ¶
Origin retrieves the origin of the given #graphene_ray_t.
The function returns the following values:
- origin: return location for the origin.
func (*Ray) PositionAt ¶
PositionAt retrieves the coordinates of a point at the distance t along the given #graphene_ray_t.
The function takes the following parameters:
- t: distance along the ray.
The function returns the following values:
- position: return location for the position.
type RayIntersectionKind ¶
RayIntersectionKind: type of intersection.
const ( // RayIntersectionKindNone: no intersection. RayIntersectionKindNone RayIntersectionKind = iota // RayIntersectionKindEnter: ray is entering the intersected object. RayIntersectionKindEnter // RayIntersectionKindLeave: ray is leaving the intersected object. RayIntersectionKindLeave )
func (RayIntersectionKind) String ¶
func (r RayIntersectionKind) String() string
String returns the name in string for RayIntersectionKind.
type Rect ¶
type Rect struct {
// contains filtered or unexported fields
}
Rect: location and size of a rectangle region.
The width and height of a #graphene_rect_t can be negative; for instance, a #graphene_rect_t with an origin of [ 0, 0 ] and a size of [ 10, 10 ] is equivalent to a #graphene_rect_t with an origin of [ 10, 10 ] and a size of [ -10, -10 ].
Application code can normalize rectangles using graphene_rect_normalize(); this function will ensure that the width and height of a rectangle are positive values. All functions taking a #graphene_rect_t as an argument will internally operate on a normalized copy; all functions returning a #graphene_rect_t will always return a normalized rectangle.
An instance of this type is always passed by reference.
func RectAlloc ¶
func RectAlloc() *Rect
RectAlloc allocates a new #graphene_rect_t.
The contents of the returned rectangle are undefined.
The function returns the following values:
- rect: newly allocated rectangle.
func RectZero ¶
func RectZero() *Rect
RectZero returns a degenerate rectangle with origin fixed at (0, 0) and a size of 0, 0.
The function returns the following values:
- rect: fixed rectangle.
func (*Rect) Area ¶
Area: compute the area of given normalized rectangle.
The function returns the following values:
- gfloat: area of the normalized rectangle.
func (*Rect) BottomLeft ¶
BottomLeft retrieves the coordinates of the bottom-left corner of the given rectangle.
The function returns the following values:
- p: return location for a #graphene_point_t.
func (*Rect) BottomRight ¶
BottomRight retrieves the coordinates of the bottom-right corner of the given rectangle.
The function returns the following values:
- p: return location for a #graphene_point_t.
func (*Rect) Center ¶
Center retrieves the coordinates of the center of the given rectangle.
The function returns the following values:
- p: return location for a #graphene_point_t.
func (*Rect) ContainsPoint ¶
ContainsPoint checks whether a #graphene_rect_t contains the given coordinates.
The function takes the following parameters:
- p: #graphene_point_t.
The function returns the following values:
- ok: true if the rectangle contains the point.
func (*Rect) ContainsRect ¶
ContainsRect checks whether a #graphene_rect_t fully contains the given rectangle.
The function takes the following parameters:
- b: #graphene_rect_t.
The function returns the following values:
- ok: true if the rectangle a fully contains b.
func (*Rect) Equal ¶
Equal checks whether the two given rectangle are equal.
The function takes the following parameters:
- b: #graphene_rect_t.
The function returns the following values:
- ok: true if the rectangles are equal.
func (*Rect) Expand ¶
Expand expands a #graphene_rect_t to contain the given #graphene_point_t.
The function takes the following parameters:
- p: #graphene_point_t.
The function returns the following values:
- res: return location for the expanded rectangle.
func (*Rect) Height ¶
Height retrieves the normalized height of the given rectangle.
The function returns the following values:
- gfloat: normalized height of the rectangle.
func (*Rect) Init ¶
Init initializes the given #graphene_rect_t with the given values.
This function will implicitly normalize the #graphene_rect_t before returning.
The function takes the following parameters:
- x: x coordinate of the graphene_rect_t.origin.
- y: y coordinate of the graphene_rect_t.origin.
- width of the graphene_rect_t.size.
- height of the graphene_rect_t.size.
The function returns the following values:
- rect: initialized rectangle.
func (*Rect) InitFromRect ¶
InitFromRect initializes r using the given src rectangle.
This function will implicitly normalize the #graphene_rect_t before returning.
The function takes the following parameters:
- src: #graphene_rect_t.
The function returns the following values:
- rect: initialized rectangle.
func (*Rect) Inset ¶
Inset changes the given rectangle to be smaller, or larger depending on the given inset parameters.
To create an inset rectangle, use positive d_x or d_y values; to create a larger, encompassing rectangle, use negative d_x or d_y values.
The origin of the rectangle is offset by d_x and d_y, while the size is adjusted by (2 * d_x, 2 * d_y). If d_x and d_y are positive values, the size of the rectangle is decreased; if d_x and d_y are negative values, the size of the rectangle is increased.
If the size of the resulting inset rectangle has a negative width or height then the size will be set to zero.
The function takes the following parameters:
- dX: horizontal inset.
- dY: vertical inset.
The function returns the following values:
- rect: inset rectangle.
func (*Rect) InsetR ¶
InsetR changes the given rectangle to be smaller, or larger depending on the given inset parameters.
To create an inset rectangle, use positive d_x or d_y values; to create a larger, encompassing rectangle, use negative d_x or d_y values.
The origin of the rectangle is offset by d_x and d_y, while the size is adjusted by (2 * d_x, 2 * d_y). If d_x and d_y are positive values, the size of the rectangle is decreased; if d_x and d_y are negative values, the size of the rectangle is increased.
If the size of the resulting inset rectangle has a negative width or height then the size will be set to zero.
The function takes the following parameters:
- dX: horizontal inset.
- dY: vertical inset.
The function returns the following values:
- res: return location for the inset rectangle.
func (*Rect) Interpolate ¶
Interpolate: linearly interpolates the origin and size of the two given rectangles.
The function takes the following parameters:
- b: #graphene_rect_t.
- factor: linear interpolation factor.
The function returns the following values:
- res: return location for the interpolated rectangle.
func (*Rect) Intersection ¶
Intersection computes the intersection of the two given rectangles.
! (rectangle-intersection.png)
The intersection in the image above is the blue outline.
If the two rectangles do not intersect, res will contain a degenerate rectangle with origin in (0, 0) and a size of 0.
The function takes the following parameters:
- b: #graphene_rect_t.
The function returns the following values:
- res (optional): return location for a #graphene_rect_t.
- ok: true if the two rectangles intersect.
func (*Rect) Normalize ¶
Normalize normalizes the passed rectangle.
This function ensures that the size of the rectangle is made of positive values, and that the origin is the top-left corner of the rectangle.
The function returns the following values:
- rect: normalized rectangle.
func (*Rect) NormalizeR ¶
NormalizeR normalizes the passed rectangle.
This function ensures that the size of the rectangle is made of positive values, and that the origin is in the top-left corner of the rectangle.
The function returns the following values:
- res: return location for the normalized rectangle.
func (*Rect) Offset ¶
Offset offsets the origin by d_x and d_y.
The size of the rectangle is unchanged.
The function takes the following parameters:
- dX: horizontal offset.
- dY: vertical offset.
The function returns the following values:
- rect: offset rectangle.
func (*Rect) OffsetR ¶
OffsetR offsets the origin of the given rectangle by d_x and d_y.
The size of the rectangle is left unchanged.
The function takes the following parameters:
- dX: horizontal offset.
- dY: vertical offset.
The function returns the following values:
- res: return location for the offset rectangle.
func (*Rect) Round
deprecated
Round rounds the origin and size of the given rectangle to their nearest integer values; the rounding is guaranteed to be large enough to have an area bigger or equal to the original rectangle, but might not fully contain its extents. Use graphene_rect_round_extents() in case you need to round to a rectangle that covers fully the original one.
This function is the equivalent of calling floor on the coordinates of the origin, and ceil on the size.
Deprecated: Use graphene_rect_round_extents() instead.
The function returns the following values:
- res: return location for the rounded rectangle.
func (*Rect) RoundExtents ¶
RoundExtents rounds the origin of the given rectangle to its nearest integer value and and recompute the size so that the rectangle is large enough to contain all the conrners of the original rectangle.
This function is the equivalent of calling floor on the coordinates of the origin, and recomputing the size calling ceil on the bottom-right coordinates.
If you want to be sure that the rounded rectangle completely covers the area that was covered by the original rectangle — i.e. you want to cover the area including all its corners — this function will make sure that the size is recomputed taking into account the ceiling of the coordinates of the bottom-right corner. If the difference between the original coordinates and the coordinates of the rounded rectangle is greater than the difference between the original size and and the rounded size, then the move of the origin would not be compensated by a move in the anti-origin, leaving the corners of the original rectangle outside the rounded one.
The function returns the following values:
- res: return location for the rectangle with rounded extents.
func (*Rect) RoundToPixel
deprecated
RoundToPixel rounds the origin and the size of the given rectangle to their nearest integer values; the rounding is guaranteed to be large enough to contain the original rectangle.
Deprecated: Use graphene_rect_round() instead.
The function returns the following values:
- rect: pixel-aligned rectangle.
func (*Rect) Scale ¶
Scale scales the size and origin of a rectangle horizontaly by s_h, and vertically by s_v. The result res is normalized.
The function takes the following parameters:
- sH: horizontal scale factor.
- sV: vertical scale factor.
The function returns the following values:
- res: return location for the scaled rectangle.
func (*Rect) TopLeft ¶
TopLeft retrieves the coordinates of the top-left corner of the given rectangle.
The function returns the following values:
- p: return location for a #graphene_point_t.
func (*Rect) TopRight ¶
TopRight retrieves the coordinates of the top-right corner of the given rectangle.
The function returns the following values:
- p: return location for a #graphene_point_t.
func (*Rect) Union ¶
Union computes the union of the two given rectangles.
! (rectangle-union.png)
The union in the image above is the blue outline.
The function takes the following parameters:
- b: #graphene_rect_t.
The function returns the following values:
- res: return location for a #graphene_rect_t.
func (*Rect) Vertices ¶
Vertices computes the four vertices of a #graphene_rect_t.
The function returns the following values:
- vertices: return location for an array of 4 #graphene_vec2_t.
func (*Rect) Width ¶
Width retrieves the normalized width of the given rectangle.
The function returns the following values:
- gfloat: normalized width of the rectangle.
type SIMD4F ¶
type SIMD4F struct {
// contains filtered or unexported fields
}
SIMD4F: instance of this type is always passed by reference.
type SIMD4X4F ¶
type SIMD4X4F struct {
// contains filtered or unexported fields
}
SIMD4X4F: instance of this type is always passed by reference.
type Size ¶
type Size struct {
// contains filtered or unexported fields
}
Size: size.
An instance of this type is always passed by reference.
func SizeZero ¶
func SizeZero() *Size
SizeZero: constant pointer to a zero #graphene_size_t, useful for equality checks and interpolations.
The function returns the following values:
- size: constant size.
func (*Size) Equal ¶
Equal checks whether the two give #graphene_size_t are equal.
The function takes the following parameters:
- b: #graphene_size_t.
The function returns the following values:
- ok: true if the sizes are equal.
func (*Size) Init ¶
Init initializes a #graphene_size_t using the given width and height.
The function takes the following parameters:
- width: width.
- height: height.
The function returns the following values:
- size: initialized #graphene_size_t.
func (*Size) InitFromSize ¶
InitFromSize initializes a #graphene_size_t using the width and height of the given src.
The function takes the following parameters:
- src: #graphene_size_t.
The function returns the following values:
- size: initialized #graphene_size_t.
func (*Size) Interpolate ¶
Interpolate: linearly interpolates the two given #graphene_size_t using the given interpolation factor.
The function takes the following parameters:
- b: #graphene_size_t.
- factor: linear interpolation factor.
The function returns the following values:
- res: return location for the interpolated size.
type Sphere ¶
type Sphere struct {
// contains filtered or unexported fields
}
Sphere: sphere, represented by its center and radius.
An instance of this type is always passed by reference.
func (*Sphere) BoundingBox ¶
BoundingBox computes the bounding box capable of containing the given #graphene_sphere_t.
The function returns the following values:
- box: return location for the bounding box.
func (*Sphere) Center ¶
Center retrieves the coordinates of the center of a #graphene_sphere_t.
The function returns the following values:
- center: return location for the coordinates of the center.
func (*Sphere) ContainsPoint ¶
ContainsPoint checks whether the given point is contained in the volume of a #graphene_sphere_t.
The function takes the following parameters:
- point: #graphene_point3d_t.
The function returns the following values:
- ok: true if the sphere contains the point.
func (*Sphere) Distance ¶
Distance computes the distance of the given point from the surface of a #graphene_sphere_t.
The function takes the following parameters:
- point: #graphene_point3d_t.
The function returns the following values:
- gfloat: distance of the point.
func (*Sphere) Equal ¶
Equal checks whether two #graphene_sphere_t are equal.
The function takes the following parameters:
- b: #graphene_sphere_t.
The function returns the following values:
- ok: true if the spheres are equal.
func (*Sphere) Init ¶
Init initializes the given #graphene_sphere_t with the given center and radius.
The function takes the following parameters:
- center (optional) coordinates of the center of the sphere, or NULL for a center in (0, 0, 0).
- radius of the sphere.
The function returns the following values:
- sphere: initialized #graphene_sphere_t.
func (*Sphere) InitFromPoints ¶
InitFromPoints initializes the given #graphene_sphere_t using the given array of 3D coordinates so that the sphere includes them.
The center of the sphere can either be specified, or will be center of the 3D volume that encompasses all points.
The function takes the following parameters:
- points: array of #graphene_point3d_t.
- center (optional) of the sphere.
The function returns the following values:
- sphere: initialized #graphene_sphere_t.
func (*Sphere) InitFromVectors ¶
InitFromVectors initializes the given #graphene_sphere_t using the given array of 3D coordinates so that the sphere includes them.
The center of the sphere can either be specified, or will be center of the 3D volume that encompasses all vectors.
The function takes the following parameters:
- vectors: array of #graphene_vec3_t.
- center (optional) of the sphere.
The function returns the following values:
- sphere: initialized #graphene_sphere_t.
func (*Sphere) IsEmpty ¶
IsEmpty checks whether the sphere has a zero radius.
The function returns the following values:
- ok: true if the sphere is empty.
func (*Sphere) Radius ¶
Radius retrieves the radius of a #graphene_sphere_t.
The function returns the following values:
func (*Sphere) Translate ¶
Translate translates the center of the given #graphene_sphere_t using the point coordinates as the delta of the translation.
The function takes the following parameters:
- point coordinates of the translation.
The function returns the following values:
- res: return location for the translated sphere.
type Triangle ¶
type Triangle struct {
// contains filtered or unexported fields
}
Triangle: triangle.
An instance of this type is always passed by reference.
func NewTriangleAlloc ¶
func NewTriangleAlloc() *Triangle
NewTriangleAlloc constructs a struct Triangle.
func (*Triangle) Area ¶
Area computes the area of the given #graphene_triangle_t.
The function returns the following values:
- gfloat: area of the triangle.
func (*Triangle) Barycoords ¶
Barycoords computes the barycentric coordinates (http://en.wikipedia.org/wiki/Barycentric_coordinate_system) of the given point p.
The point p must lie on the same plane as the triangle t; if the point is not coplanar, the result of this function is undefined.
If we place the origin in the coordinates of the triangle's A point, the barycentric coordinates are u, which is on the AC vector; and v which is on the AB vector:
! (triangle-barycentric.png)
The returned #graphene_vec2_t contains the following values, in order:
- res.x = u
- res.y = v.
The function takes the following parameters:
- p (optional): #graphene_point3d_t.
The function returns the following values:
- res: return location for the vector with the barycentric coordinates.
- ok: true if the barycentric coordinates are valid.
func (*Triangle) BoundingBox ¶
BoundingBox computes the bounding box of the given #graphene_triangle_t.
The function returns the following values:
- res: return location for the box.
func (*Triangle) ContainsPoint ¶
ContainsPoint checks whether the given triangle t contains the point p.
The function takes the following parameters:
- p: #graphene_point3d_t.
The function returns the following values:
- ok: true if the point is inside the triangle.
func (*Triangle) Equal ¶
Equal checks whether the two given #graphene_triangle_t are equal.
The function takes the following parameters:
- b: #graphene_triangle_t.
The function returns the following values:
- ok: true if the triangles are equal.
func (*Triangle) InitFromFloat ¶
InitFromFloat initializes a #graphene_triangle_t using the three given arrays of floating point values, each representing the coordinates of a point in 3D space.
The function takes the following parameters:
- a: array of 3 floating point values.
- b: array of 3 floating point values.
- c: array of 3 floating point values.
The function returns the following values:
- triangle: initialized #graphene_triangle_t.
func (*Triangle) InitFromPoint3D ¶
InitFromPoint3D initializes a #graphene_triangle_t using the three given 3D points.
The function takes the following parameters:
- a (optional): #graphene_point3d_t.
- b (optional): #graphene_point3d_t.
- c (optional): #graphene_point3d_t.
The function returns the following values:
- triangle: initialized #graphene_triangle_t.
func (*Triangle) InitFromVec3 ¶
InitFromVec3 initializes a #graphene_triangle_t using the three given vectors.
The function takes the following parameters:
- a (optional): #graphene_vec3_t.
- b (optional): #graphene_vec3_t.
- c (optional): #graphene_vec3_t.
The function returns the following values:
- triangle: initialized #graphene_triangle_t.
func (*Triangle) Midpoint ¶
Midpoint computes the coordinates of the midpoint of the given #graphene_triangle_t.
The midpoint G is the centroid (https://en.wikipedia.org/wiki/Centroid#Triangle_centroid) of the triangle, i.e. the intersection of its medians.
The function returns the following values:
- res: return location for the coordinates of the midpoint.
func (*Triangle) Normal ¶
Normal computes the normal vector of the given #graphene_triangle_t.
The function returns the following values:
- res: return location for the normal vector.
func (*Triangle) Plane ¶
Plane computes the plane based on the vertices of the given #graphene_triangle_t.
The function returns the following values:
- res: return location for the plane.
func (*Triangle) Points ¶
Points retrieves the three vertices of the given #graphene_triangle_t and returns their coordinates as #graphene_point3d_t.
The function returns the following values:
- a (optional): return location for the coordinates of the first vertex.
- b (optional): return location for the coordinates of the second vertex.
- c (optional): return location for the coordinates of the third vertex.
func (*Triangle) Uv ¶
Uv computes the UV coordinates of the given point p.
The point p must lie on the same plane as the triangle t; if the point is not coplanar, the result of this function is undefined. If p is NULL, the point will be set in (0, 0, 0).
The UV coordinates will be placed in the res vector:
- res.x = u
- res.y = v
See also: graphene_triangle_get_barycoords().
The function takes the following parameters:
- p (optional): #graphene_point3d_t.
- uvA: UV coordinates of the first point.
- uvB: UV coordinates of the second point.
- uvC: UV coordinates of the third point.
The function returns the following values:
- res: vector containing the UV coordinates of the given point p.
- ok: true if the coordinates are valid.
func (*Triangle) Vertices ¶
Vertices retrieves the three vertices of the given #graphene_triangle_t.
The function returns the following values:
- a (optional): return location for the first vertex.
- b (optional): return location for the second vertex.
- c (optional): return location for the third vertex.
type Vec2 ¶
type Vec2 struct {
// contains filtered or unexported fields
}
Vec2: structure capable of holding a vector with two dimensions, x and y.
The contents of the #graphene_vec2_t structure are private and should never be accessed directly.
An instance of this type is always passed by reference.
func Vec2One ¶
func Vec2One() *Vec2
Vec2One retrieves a constant vector with (1, 1) components.
The function returns the following values:
- vec2: one vector.
func Vec2XAxis ¶
func Vec2XAxis() *Vec2
Vec2XAxis retrieves a constant vector with (1, 0) components.
The function returns the following values:
- vec2: x axis vector.
func Vec2YAxis ¶
func Vec2YAxis() *Vec2
Vec2YAxis retrieves a constant vector with (0, 1) components.
The function returns the following values:
- vec2: y axis vector.
func Vec2Zero ¶
func Vec2Zero() *Vec2
Vec2Zero retrieves a constant vector with (0, 0) components.
The function returns the following values:
- vec2: zero vector.
func (*Vec2) Add ¶
Add adds each component of the two passed vectors and places each result into the components of res.
The function takes the following parameters:
- b: #graphene_vec2_t.
The function returns the following values:
- res: return location for the result.
func (*Vec2) Divide ¶
Divide divides each component of the first operand a by the corresponding component of the second operand b, and places the results into the vector res.
The function takes the following parameters:
- b: #graphene_vec2_t.
The function returns the following values:
- res: return location for the result.
func (*Vec2) Dot ¶
Dot computes the dot product of the two given vectors.
The function takes the following parameters:
- b: #graphene_vec2_t.
The function returns the following values:
- gfloat: dot product of the vectors.
func (*Vec2) Equal ¶
Equal checks whether the two given #graphene_vec2_t are equal.
The function takes the following parameters:
- v2: #graphene_vec2_t.
The function returns the following values:
- ok: true if the two vectors are equal, and false otherwise.
func (*Vec2) Init ¶
Init initializes a #graphene_vec2_t using the given values.
This function can be called multiple times.
The function takes the following parameters:
- x: x field of the vector.
- y: y field of the vector.
The function returns the following values:
- vec2: initialized vector.
func (*Vec2) InitFromFloat ¶
InitFromFloat initializes v with the contents of the given array.
The function takes the following parameters:
- src: array of floating point values with at least two elements.
The function returns the following values:
- vec2: initialized vector.
func (*Vec2) InitFromVec2 ¶
InitFromVec2 copies the contents of src into v.
The function takes the following parameters:
- src: #graphene_vec2_t.
The function returns the following values:
- vec2: initialized vector.
func (*Vec2) Interpolate ¶
Interpolate: linearly interpolates v1 and v2 using the given factor.
The function takes the following parameters:
- v2: #graphene_vec2_t.
- factor: interpolation factor.
The function returns the following values:
- res: interpolated vector.
func (*Vec2) Length ¶
Length computes the length of the given vector.
The function returns the following values:
- gfloat: length of the vector.
func (*Vec2) Max ¶
Max compares the two given vectors and places the maximum values of each component into res.
The function takes the following parameters:
- b: #graphene_vec2_t.
The function returns the following values:
- res: resulting vector.
func (*Vec2) Min ¶
Min compares the two given vectors and places the minimum values of each component into res.
The function takes the following parameters:
- b: #graphene_vec2_t.
The function returns the following values:
- res: resulting vector.
func (*Vec2) Multiply ¶
Multiply multiplies each component of the two passed vectors and places each result into the components of res.
The function takes the following parameters:
- b: #graphene_vec2_t.
The function returns the following values:
- res: return location for the result.
func (*Vec2) Near ¶
Near compares the two given #graphene_vec2_t vectors and checks whether their values are within the given epsilon.
The function takes the following parameters:
- v2: #graphene_vec2_t.
- epsilon: threshold between the two vectors.
The function returns the following values:
- ok: true if the two vectors are near each other.
func (*Vec2) Negate ¶
Negate negates the given #graphene_vec2_t.
The function returns the following values:
- res: return location for the result vector.
func (*Vec2) Normalize ¶
Normalize computes the normalized vector for the given vector v.
The function returns the following values:
- res: return location for the normalized vector.
func (*Vec2) Scale ¶
Scale multiplies all components of the given vector with the given scalar factor.
The function takes the following parameters:
- factor: scalar factor.
The function returns the following values:
- res: return location for the result vector.
func (*Vec2) Subtract ¶
Subtract subtracts from each component of the first operand a the corresponding component of the second operand b and places each result into the components of res.
The function takes the following parameters:
- b: #graphene_vec2_t.
The function returns the following values:
- res: return location for the result.
func (*Vec2) ToFloat ¶
ToFloat stores the components of v into an array.
The function returns the following values:
- dest: return location for an array of floating point values with at least 2 elements.
type Vec3 ¶
type Vec3 struct {
// contains filtered or unexported fields
}
Vec3: structure capable of holding a vector with three dimensions: x, y, and z.
The contents of the #graphene_vec3_t structure are private and should never be accessed directly.
An instance of this type is always passed by reference.
func Vec3One ¶
func Vec3One() *Vec3
Vec3One provides a constant pointer to a vector with three components, all sets to 1.
The function returns the following values:
- vec3: constant vector.
func Vec3XAxis ¶
func Vec3XAxis() *Vec3
Vec3XAxis provides a constant pointer to a vector with three components with values set to (1, 0, 0).
The function returns the following values:
- vec3: constant vector.
func Vec3YAxis ¶
func Vec3YAxis() *Vec3
Vec3YAxis provides a constant pointer to a vector with three components with values set to (0, 1, 0).
The function returns the following values:
- vec3: constant vector.
func Vec3ZAxis ¶
func Vec3ZAxis() *Vec3
Vec3ZAxis provides a constant pointer to a vector with three components with values set to (0, 0, 1).
The function returns the following values:
- vec3: constant vector.
func Vec3Zero ¶
func Vec3Zero() *Vec3
Vec3Zero provides a constant pointer to a vector with three components, all sets to 0.
The function returns the following values:
- vec3: constant vector.
func (*Vec3) Add ¶
Add adds each component of the two given vectors.
The function takes the following parameters:
- b: #graphene_vec3_t.
The function returns the following values:
- res: return location for the resulting vector.
func (*Vec3) Cross ¶
Cross computes the cross product of the two given vectors.
The function takes the following parameters:
- b: #graphene_vec3_t.
The function returns the following values:
- res: return location for the resulting vector.
func (*Vec3) Divide ¶
Divide divides each component of the first operand a by the corresponding component of the second operand b, and places the results into the vector res.
The function takes the following parameters:
- b: #graphene_vec3_t.
The function returns the following values:
- res: return location for the resulting vector.
func (*Vec3) Dot ¶
Dot computes the dot product of the two given vectors.
The function takes the following parameters:
- b: #graphene_vec3_t.
The function returns the following values:
- gfloat: value of the dot product.
func (*Vec3) Equal ¶
Equal checks whether the two given #graphene_vec3_t are equal.
The function takes the following parameters:
- v2: #graphene_vec3_t.
The function returns the following values:
- ok: true if the two vectors are equal, and false otherwise.
func (*Vec3) Init ¶
Init initializes a #graphene_vec3_t using the given values.
This function can be called multiple times.
The function takes the following parameters:
- x: x field of the vector.
- y: y field of the vector.
- z: z field of the vector.
The function returns the following values:
- vec3: pointer to the initialized vector.
func (*Vec3) InitFromFloat ¶
InitFromFloat initializes a #graphene_vec3_t with the values from an array.
The function takes the following parameters:
- src: array of 3 floating point values.
The function returns the following values:
- vec3: initialized vector.
func (*Vec3) InitFromVec3 ¶
InitFromVec3 initializes a #graphene_vec3_t with the values of another #graphene_vec3_t.
The function takes the following parameters:
- src: #graphene_vec3_t.
The function returns the following values:
- vec3: initialized vector.
func (*Vec3) Interpolate ¶
Interpolate: linearly interpolates v1 and v2 using the given factor.
The function takes the following parameters:
- v2: #graphene_vec3_t.
- factor: interpolation factor.
The function returns the following values:
- res: interpolated vector.
func (*Vec3) Length ¶
Length retrieves the length of the given vector v.
The function returns the following values:
- gfloat: value of the length of the vector.
func (*Vec3) Max ¶
Max compares each component of the two given vectors and creates a vector that contains the maximum values.
The function takes the following parameters:
- b: #graphene_vec3_t.
The function returns the following values:
- res: return location for the result vector.
func (*Vec3) Min ¶
Min compares each component of the two given vectors and creates a vector that contains the minimum values.
The function takes the following parameters:
- b: #graphene_vec3_t.
The function returns the following values:
- res: return location for the result vector.
func (*Vec3) Multiply ¶
Multiply multiplies each component of the two given vectors.
The function takes the following parameters:
- b: #graphene_vec3_t.
The function returns the following values:
- res: return location for the resulting vector.
func (*Vec3) Near ¶
Near compares the two given #graphene_vec3_t vectors and checks whether their values are within the given epsilon.
The function takes the following parameters:
- v2: #graphene_vec3_t.
- epsilon: threshold between the two vectors.
The function returns the following values:
- ok: true if the two vectors are near each other.
func (*Vec3) Negate ¶
Negate negates the given #graphene_vec3_t.
The function returns the following values:
- res: return location for the result vector.
func (*Vec3) Normalize ¶
Normalize normalizes the given #graphene_vec3_t.
The function returns the following values:
- res: return location for the normalized vector.
func (*Vec3) Scale ¶
Scale multiplies all components of the given vector with the given scalar factor.
The function takes the following parameters:
- factor: scalar factor.
The function returns the following values:
- res: return location for the result vector.
func (*Vec3) Subtract ¶
Subtract subtracts from each component of the first operand a the corresponding component of the second operand b and places each result into the components of res.
The function takes the following parameters:
- b: #graphene_vec3_t.
The function returns the following values:
- res: return location for the resulting vector.
func (*Vec3) ToFloat ¶
ToFloat copies the components of a #graphene_vec3_t into the given array.
The function returns the following values:
- dest: return location for an array of floating point values.
func (*Vec3) X ¶
X retrieves the first component of the given vector v.
The function returns the following values:
- gfloat: value of the first component of the vector.
func (*Vec3) XY ¶
XY creates a #graphene_vec2_t that contains the first and second components of the given #graphene_vec3_t.
The function returns the following values:
- res: return location for a #graphene_vec2_t.
func (*Vec3) XY0 ¶
XY0 creates a #graphene_vec3_t that contains the first two components of the given #graphene_vec3_t, and the third component set to 0.
The function returns the following values:
- res: return location for a #graphene_vec3_t.
func (*Vec3) XYZ0 ¶
XYZ0 converts a #graphene_vec3_t in a #graphene_vec4_t using 0.0 as the value for the fourth component of the resulting vector.
The function returns the following values:
- res: return location for the vector.
func (*Vec3) XYZ1 ¶
XYZ1 converts a #graphene_vec3_t in a #graphene_vec4_t using 1.0 as the value for the fourth component of the resulting vector.
The function returns the following values:
- res: return location for the vector.
func (*Vec3) Xyzw ¶
Xyzw converts a #graphene_vec3_t in a #graphene_vec4_t using w as the value of the fourth component of the resulting vector.
The function takes the following parameters:
- w: value of the W component.
The function returns the following values:
- res: return location for the vector.
type Vec4 ¶
type Vec4 struct {
// contains filtered or unexported fields
}
Vec4: structure capable of holding a vector with four dimensions: x, y, z, and w.
The contents of the #graphene_vec4_t structure are private and should never be accessed directly.
An instance of this type is always passed by reference.
func Vec4One ¶
func Vec4One() *Vec4
Vec4One retrieves a pointer to a #graphene_vec4_t with all its components set to 1.
The function returns the following values:
- vec4: constant vector.
func Vec4WAxis ¶
func Vec4WAxis() *Vec4
Vec4WAxis retrieves a pointer to a #graphene_vec4_t with its components set to (0, 0, 0, 1).
The function returns the following values:
- vec4: constant vector.
func Vec4XAxis ¶
func Vec4XAxis() *Vec4
Vec4XAxis retrieves a pointer to a #graphene_vec4_t with its components set to (1, 0, 0, 0).
The function returns the following values:
- vec4: constant vector.
func Vec4YAxis ¶
func Vec4YAxis() *Vec4
Vec4YAxis retrieves a pointer to a #graphene_vec4_t with its components set to (0, 1, 0, 0).
The function returns the following values:
- vec4: constant vector.
func Vec4ZAxis ¶
func Vec4ZAxis() *Vec4
Vec4ZAxis retrieves a pointer to a #graphene_vec4_t with its components set to (0, 0, 1, 0).
The function returns the following values:
- vec4: constant vector.
func Vec4Zero ¶
func Vec4Zero() *Vec4
Vec4Zero retrieves a pointer to a #graphene_vec4_t with all its components set to 0.
The function returns the following values:
- vec4: constant vector.
func (*Vec4) Add ¶
Add adds each component of the two given vectors.
The function takes the following parameters:
- b: #graphene_vec4_t.
The function returns the following values:
- res: return location for the resulting vector.
func (*Vec4) Divide ¶
Divide divides each component of the first operand a by the corresponding component of the second operand b, and places the results into the vector res.
The function takes the following parameters:
- b: #graphene_vec4_t.
The function returns the following values:
- res: return location for the resulting vector.
func (*Vec4) Dot ¶
Dot computes the dot product of the two given vectors.
The function takes the following parameters:
- b: #graphene_vec4_t.
The function returns the following values:
- gfloat: value of the dot product.
func (*Vec4) Equal ¶
Equal checks whether the two given #graphene_vec4_t are equal.
The function takes the following parameters:
- v2: #graphene_vec4_t.
The function returns the following values:
- ok: true if the two vectors are equal, and false otherwise.
func (*Vec4) Init ¶
Init initializes a #graphene_vec4_t using the given values.
This function can be called multiple times.
The function takes the following parameters:
- x: x field of the vector.
- y: y field of the vector.
- z: z field of the vector.
- w: w field of the vector.
The function returns the following values:
- vec4: pointer to the initialized vector.
func (*Vec4) InitFromFloat ¶
InitFromFloat initializes a #graphene_vec4_t with the values inside the given array.
The function takes the following parameters:
- src: array of four floating point values.
The function returns the following values:
- vec4: initialized vector.
func (*Vec4) InitFromVec2 ¶
InitFromVec2 initializes a #graphene_vec4_t using the components of a #graphene_vec2_t and the values of z and w.
The function takes the following parameters:
- src: #graphene_vec2_t.
- z: value for the third component of v.
- w: value for the fourth component of v.
The function returns the following values:
- vec4: initialized vector.
func (*Vec4) InitFromVec3 ¶
InitFromVec3 initializes a #graphene_vec4_t using the components of a #graphene_vec3_t and the value of w.
The function takes the following parameters:
- src: #graphene_vec3_t.
- w: value for the fourth component of v.
The function returns the following values:
- vec4: initialized vector.
func (*Vec4) InitFromVec4 ¶
InitFromVec4 initializes a #graphene_vec4_t using the components of another #graphene_vec4_t.
The function takes the following parameters:
- src: #graphene_vec4_t.
The function returns the following values:
- vec4: initialized vector.
func (*Vec4) Interpolate ¶
Interpolate: linearly interpolates v1 and v2 using the given factor.
The function takes the following parameters:
- v2: #graphene_vec4_t.
- factor: interpolation factor.
The function returns the following values:
- res: interpolated vector.
func (*Vec4) Length ¶
Length computes the length of the given #graphene_vec4_t.
The function returns the following values:
- gfloat: length of the vector.
func (*Vec4) Max ¶
Max compares each component of the two given vectors and creates a vector that contains the maximum values.
The function takes the following parameters:
- b: #graphene_vec4_t.
The function returns the following values:
- res: return location for the result vector.
func (*Vec4) Min ¶
Min compares each component of the two given vectors and creates a vector that contains the minimum values.
The function takes the following parameters:
- b: #graphene_vec4_t.
The function returns the following values:
- res: return location for the result vector.
func (*Vec4) Multiply ¶
Multiply multiplies each component of the two given vectors.
The function takes the following parameters:
- b: #graphene_vec4_t.
The function returns the following values:
- res: return location for the resulting vector.
func (*Vec4) Near ¶
Near compares the two given #graphene_vec4_t vectors and checks whether their values are within the given epsilon.
The function takes the following parameters:
- v2: #graphene_vec4_t.
- epsilon: threshold between the two vectors.
The function returns the following values:
- ok: true if the two vectors are near each other.
func (*Vec4) Negate ¶
Negate negates the given #graphene_vec4_t.
The function returns the following values:
- res: return location for the result vector.
func (*Vec4) Normalize ¶
Normalize normalizes the given #graphene_vec4_t.
The function returns the following values:
- res: return location for the normalized vector.
func (*Vec4) Scale ¶
Scale multiplies all components of the given vector with the given scalar factor.
The function takes the following parameters:
- factor: scalar factor.
The function returns the following values:
- res: return location for the result vector.
func (*Vec4) Subtract ¶
Subtract subtracts from each component of the first operand a the corresponding component of the second operand b and places each result into the components of res.
The function takes the following parameters:
- b: #graphene_vec4_t.
The function returns the following values:
- res: return location for the resulting vector.
func (*Vec4) ToFloat ¶
ToFloat stores the components of the given #graphene_vec4_t into an array of floating point values.
The function returns the following values:
- dest: return location for an array of floating point values.
func (*Vec4) W ¶
W retrieves the value of the fourth component of the given #graphene_vec4_t.
The function returns the following values:
- gfloat: value of the fourth component.
func (*Vec4) X ¶
X retrieves the value of the first component of the given #graphene_vec4_t.
The function returns the following values:
- gfloat: value of the first component.
func (*Vec4) XY ¶
XY creates a #graphene_vec2_t that contains the first two components of the given #graphene_vec4_t.
The function returns the following values:
- res: return location for a #graphene_vec2_t.
func (*Vec4) XYZ ¶
XYZ creates a #graphene_vec3_t that contains the first three components of the given #graphene_vec4_t.
The function returns the following values:
- res: return location for a graphene_vec3_t.