Documentation ¶
Index ¶
- type CumulativeDistribution
- func (self *CumulativeDistribution) Add(value interface{}, intervalSize float32)
- func (self *CumulativeDistribution) AddValue(value interface{})
- func (self *CumulativeDistribution) Clear()
- func (self *CumulativeDistribution) Generate()
- func (self *CumulativeDistribution) GenerateNormalized()
- func (self *CumulativeDistribution) GenerateUniform()
- func (self *CumulativeDistribution) GetInterval(index int) float32
- func (self *CumulativeDistribution) GetValue(index int) interface{}
- func (self *CumulativeDistribution) SetInterval(obj interface{}, intervalSize float32)
- func (self *CumulativeDistribution) SetIntervalIndex(index int, intervalSize float32)
- func (self *CumulativeDistribution) Size() int
- func (self *CumulativeDistribution) Value() interface{}
- func (self *CumulativeDistribution) ValueP(probability float32) interface{}
- type CumulativeValue
- type FloatCounter
- type Frustum
- func (self *Frustum) BoundsInFrustum(x, y, z, halfWidth, halfHeight, halfDepth float32) bool
- func (self *Frustum) BoundsInFrustumBox(bounds *BoundingBox) bool
- func (self *Frustum) BoundsInFrustumV3(center, dimensions *Vector3) bool
- func (self *Frustum) PointInFrustum(x, y, z float32) bool
- func (self *Frustum) PointInFrustumV3(point *Vector3) bool
- func (self *Frustum) SphereInFrustum(x, y, z, radius float32) bool
- func (self *Frustum) SphereInFrustumWithoutNearFar(x, y, z, radius float32) bool
- func (self *Frustum) SphereInFrustumWithoutNearFarV3(center *Vector3, radius float32) bool
- func (self *Frustum) Update(inverseProjectionView *Matrix4)
- type GridPoint2
- type GridPoint3
- type Plane
- func (self *Plane) Distance(point *Vector3) float32
- func (self *Plane) GetD() float32
- func (self *Plane) GetNormal() *Vector3
- func (self *Plane) IsFrontFacing(direction *Vector3) bool
- func (self *Plane) Set(nx, ny, nz, d float32)
- func (self *Plane) SetP3(point1, point2, point3 *Vector3)
- func (self *Plane) SetP6(pointX, pointY, pointZ, norX, norY, norZ float32)
- func (self *Plane) SetV(point, normal *Vector3)
- func (self *Plane) String() string
- func (self *Plane) TestPoint(x, y, z float32) PlaneSide
- func (self *Plane) TestPointV3(point *Vector3) PlaneSide
- type PlaneSide
- type WindowedMean
- func (self *WindowedMean) AddValue(value float32)
- func (self *WindowedMean) Clear()
- func (self *WindowedMean) GetLatest() float32
- func (self *WindowedMean) GetMean() float32
- func (self *WindowedMean) GetOldest() float32
- func (self *WindowedMean) GetWindowSize() int
- func (self *WindowedMean) HasEnoughData() bool
- func (self *WindowedMean) StandardDeviation() float32
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CumulativeDistribution ¶
type CumulativeDistribution struct {
// contains filtered or unexported fields
}
This class represents a cumulative distribution. It can be used in scenarios where there are values with different probabilities and it's required to pick one of those respecting the probability. For example one could represent the frequency of the alphabet letters using a cumulative distribution and use it to randomly pick a letter respecting their probabilities (useful when generating random words). Another example could be point generation on a mesh surface: one could generate a cumulative distribution using triangles areas as interval size, in this way triangles with a large area will be picked more often than triangles with a smaller one. See http://en.wikipedia.org/wiki/Cumulative_distribution_function for a detailed explanation.
func NewCumulativeDistribution ¶
func NewCumulativeDistribution() *CumulativeDistribution
func (*CumulativeDistribution) Add ¶
func (self *CumulativeDistribution) Add(value interface{}, intervalSize float32)
Adds a value with a given interval size to the distribution
func (*CumulativeDistribution) AddValue ¶
func (self *CumulativeDistribution) AddValue(value interface{})
Adds a value with interval size equal to zero to the distributio
func (*CumulativeDistribution) Clear ¶
func (self *CumulativeDistribution) Clear()
Removes all the values from the distribution
func (*CumulativeDistribution) Generate ¶
func (self *CumulativeDistribution) Generate()
Generate the cumulative distribution
func (*CumulativeDistribution) GenerateNormalized ¶
func (self *CumulativeDistribution) GenerateNormalized()
Generate the cumulative distribution in [0,1] where each interval will get a frequency between [0,1]
func (*CumulativeDistribution) GenerateUniform ¶
func (self *CumulativeDistribution) GenerateUniform()
Generate the cumulative distribution in [0,1] where each value will have the same frequency and interval siz
func (*CumulativeDistribution) GetInterval ¶
func (self *CumulativeDistribution) GetInterval(index int) float32
return the interval size for the value at the given position
func (*CumulativeDistribution) GetValue ¶
func (self *CumulativeDistribution) GetValue(index int) interface{}
return the value at the given position
func (*CumulativeDistribution) SetInterval ¶
func (self *CumulativeDistribution) SetInterval(obj interface{}, intervalSize float32)
Set the interval size on the passed in object. The object must be present in the distribution.
func (*CumulativeDistribution) SetIntervalIndex ¶
func (self *CumulativeDistribution) SetIntervalIndex(index int, intervalSize float32)
Sets the interval size for the value at the given index
func (*CumulativeDistribution) Size ¶
func (self *CumulativeDistribution) Size() int
return the amount of values
func (*CumulativeDistribution) Value ¶
func (self *CumulativeDistribution) Value() interface{}
return the value whose interval contains a random probability in [0,1]
func (*CumulativeDistribution) ValueP ¶
func (self *CumulativeDistribution) ValueP(probability float32) interface{}
Finds the value whose interval contains the given probability Binary search algorithm is used to find the value. param probability return the value whose interval contains the probability
type CumulativeValue ¶
type CumulativeValue struct {
// contains filtered or unexported fields
}
type FloatCounter ¶
type FloatCounter struct {
// contains filtered or unexported fields
}
Track properties of a stream of float values. The properties (total value, minimum, etc) are updated as values are put(float) into the stream.
func NewFloatCounter ¶
func NewFloatCounter(windowSize int) *FloatCounter
Construct a new FloatCounter windowSize The size of the mean window or 1 or below to not use a windowed mean
func (*FloatCounter) Put ¶
func (self *FloatCounter) Put(value float32)
Add a value and update all fields. value The value to add
func (*FloatCounter) Reset ¶
func (self *FloatCounter) Reset()
Reset all values to their default value
type Frustum ¶
type Frustum struct { // the six clipping planes, near, far, left, right, top, bottom * Planes [6]*Plane // eight points making up the near and far clipping "rectangles". order is counter clockwise, starting at bottom left * PlanePoints []*Vector3 PlanePointsArray [8 * 3]float32 }
A truncated rectangular pyramid. Used to define the viewable region and its projection onto the screen.
func NewFrustumEmpty ¶
func NewFrustumEmpty() *Frustum
func (*Frustum) BoundsInFrustum ¶
Returns whether the given bounding box is in the frustum. return Whether the bounding box is in the frustum
func (*Frustum) BoundsInFrustumBox ¶
Returns whether the given {@link BoundingBox} is in the frustum. bounds The bounding box return Whether the bounding box is in the frustum
func (*Frustum) BoundsInFrustumV3 ¶
Returns whether the given bounding box is in the frustum. return Whether the bounding box is in the frustum
func (*Frustum) PointInFrustum ¶
Returns whether the point is in the frustum. x The X coordinate of the point y The Y coordinate of the point z The Z coordinate of the point return Whether the point is in the frustum.
func (*Frustum) PointInFrustumV3 ¶
Returns whether the point is in the frustum. point The point return Whether the point is in the frustum.
func (*Frustum) SphereInFrustum ¶
Returns whether the given sphere is in the frustum. x The X coordinate of the center of the sphere y The Y coordinate of the center of the sphere z The Z coordinate of the center of the sphere radius The radius of the sphere return Whether the sphere is in the frustum
func (*Frustum) SphereInFrustumWithoutNearFar ¶
Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane. x The X coordinate of the center of the sphere y The Y coordinate of the center of the sphere z The Z coordinate of the center of the sphere radius The radius of the sphere return Whether the sphere is in the frustum
func (*Frustum) SphereInFrustumWithoutNearFarV3 ¶
Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane. center The center of the sphere radius The radius of the sphere return Whether the sphere is in the frustum
type GridPoint2 ¶
type GridPoint2 struct {
// contains filtered or unexported fields
}
A point in a 2D grid, with integer x and y coordinates
func (*GridPoint2) HashCode ¶
func (self *GridPoint2) HashCode() int
func (*GridPoint2) Set ¶
func (self *GridPoint2) Set(x, y int) *GridPoint2
Sets the coordinates of this 2D grid point.
func (*GridPoint2) SetG ¶
func (self *GridPoint2) SetG(point *GridPoint2) *GridPoint2
Sets the coordinates of this 2D grid point to that of another. point The 2D grid point to copy the coordinates of. return this 2D grid point for chaining.
func (*GridPoint2) String ¶
func (self *GridPoint2) String() string
type GridPoint3 ¶
type GridPoint3 struct {
// contains filtered or unexported fields
}
A point in a 3D grid, with integer x and y coordinates
func NewGridPoint3Empty ¶
func NewGridPoint3Empty() *GridPoint3
Constructs a 3D grid point with all coordinates pointing to the origin (0, 0, 0).
func (*GridPoint3) HashCode ¶
func (self *GridPoint3) HashCode() int
func (*GridPoint3) Set ¶
func (self *GridPoint3) Set(x, y, z int) *GridPoint3
Sets the coordinates of this GridPoint3D.
func (*GridPoint3) SetG ¶
func (self *GridPoint3) SetG(point *GridPoint3) *GridPoint3
Sets the coordinates of this 3D grid point to that of another.
func (*GridPoint3) String ¶
func (self *GridPoint3) String() string
type Plane ¶
type Plane struct {
// contains filtered or unexported fields
}
A plane defined via a unit length normal and the distance from the origin, as you learned in your math class.
func NewPlane ¶
Constructs a new plane based on the normal and distance to the origin. param normal The plane normal param d The distance to the origin
func NewPlanePoint ¶
func NewPlanePoint(normal, point *Vector3) *Plane
Constructs a new plane based on the normal and a point on the plane. param normal The normal param point The point on the plane
func NewPlanePoint3 ¶
func NewPlanePoint3(point1, point2, point3 *Vector3) *Plane
Constructs a new plane out of the three given points that are considered to be on the plane. The normal is calculated via a cross product between (point1-point2)x(point2-point3) param point1 The first point param point2 The second point param point3 The third point
func (*Plane) Distance ¶
Calculates the shortest signed distance between the plane and the given point. param point The point return the shortest signed distance between the plane and the point
func (*Plane) IsFrontFacing ¶
Returns whether the plane is facing the direction vector. Think of the direction vector as the direction a camera looks in. This method will return true if the front side of the plane determined by its normal faces the camera. param direction the direction return whether the plane is front facing
func (*Plane) Set ¶
Sets the plane normal and distance param nx normal x-component param ny normal y-component param nz normal z-component param d distance to origin
func (*Plane) SetP3 ¶
func (self *Plane) SetP3(point1, point2, point3 *Vector3)
Sets the plane normal and distance to the origin based on the three given points which are considered to be on the plane. The normal is calculated via a cross product between (point1-point2)x(point2-point3) param point1 param point2 param point3
func (*Plane) SetV ¶
func (self *Plane) SetV(point, normal *Vector3)
Sets the plane to the given point and normal. param normal the normal of the plane
func (*Plane) TestPoint ¶
Returns on which side the given point lies relative to the plane and its normal. PlaneSide.Front refers to the side the plane normal points to. return The side the point lies relative to the plane
func (*Plane) TestPointV3 ¶
Returns on which side the given point lies relative to the plane and its normal. PlaneSide.Front refers to the side the plane normal points to. param point The point return The side the point lies relative to the plane
type PlaneSide ¶
type PlaneSide int
Enum specifying on which side a point lies respective to the plane and it's normal. {@link PlaneSide#Front} is the side to which the normal points.
type WindowedMean ¶
type WindowedMean struct {
// contains filtered or unexported fields
}
A simple class keeping track of the mean of a stream of values within a certain window. the WindowedMean will only return a value in case enough data has been sampled. After enough data has been sampled the oldest sample will be replaced by the newest in case a new sample is added.
func NewWindowedMean ¶
func NewWindowedMean(window_size int) *WindowedMean
constructor, window_size specifies the number of samples we will continuously get the mean and variance from. the class will only return meaning full values if at least window_size values have been added. window_size size of the sample window
func (*WindowedMean) AddValue ¶
func (self *WindowedMean) AddValue(value float32)
adds a new sample to this mean. In case the window is full the oldest value will be replaced by this new value.
func (*WindowedMean) Clear ¶
func (self *WindowedMean) Clear()
clears this WindowedMean. The class will only return meaningful values after enough data has been added again.
func (*WindowedMean) GetLatest ¶
func (self *WindowedMean) GetLatest() float32
return the value last added
func (*WindowedMean) GetMean ¶
func (self *WindowedMean) GetMean() float32
returns the mean of the samples added to this instance. Only returns meaningful results when at least window_size samples as specified in the constructor have been added.
func (*WindowedMean) GetOldest ¶
func (self *WindowedMean) GetOldest() float32
return the oldest value in the window
func (*WindowedMean) GetWindowSize ¶
func (self *WindowedMean) GetWindowSize() int
func (*WindowedMean) HasEnoughData ¶
func (self *WindowedMean) HasEnoughData() bool
return whether the value returned will be meaningful
func (*WindowedMean) StandardDeviation ¶
func (self *WindowedMean) StandardDeviation() float32
return The standard deviation