Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AxialPosition ¶
type AxialPosition interface { // Find returns the mapped encapsulated position on the given interval Find(min, max int) int }
AxialPosition is in interface used to map an abstract value to a concrete value for an axial position
type FixedPosition ¶
type FixedPosition struct {
// contains filtered or unexported fields
}
FixedPosition is an implementation for AxialPosition that calculates a fixed position with an offset
func Fixed ¶
func Fixed(offset int) *FixedPosition
Fixed returns a FixedPosition with the given offset and reversed flag set to false
func (*FixedPosition) Find ¶
func (pos *FixedPosition) Find(min, max int) int
Find returns the mapped position on the given interval based on offset if reversed flag is set to false or negative offset otherwise
func (*FixedPosition) Offset ¶
func (pos *FixedPosition) Offset(offset int) *FixedPosition
Offset sets the offset to the given value
func (*FixedPosition) Reverse ¶
func (pos *FixedPosition) Reverse(reversed bool) *FixedPosition
Reverse sets the reversed flag to the given value
type MixedPosition ¶
type MixedPosition struct {
// contains filtered or unexported fields
}
MixedPosition is an implementation of the Position interface that can encapsulates a different method of mapping for each axis
func Pos ¶
func Pos(posX, posY AxialPosition) *MixedPosition
Pos returns a MixedPosition from the given AxialPositions
type PercentPosition ¶
type PercentPosition struct {
// contains filtered or unexported fields
}
PercentPosition is an implementation for AxialPosition that calculates a fixed position with an offset
func Percent ¶
func Percent(percent float64) *PercentPosition
Percent returns a PercentPosition with the given percent and reversed flag set to false
func (*PercentPosition) Find ¶
func (pos *PercentPosition) Find(min, max int) int
Find returns the mapped position on the given interval based on percent if reversed flag is false or negative percent otherwise
func (*PercentPosition) Percent ¶
func (pos *PercentPosition) Percent(percent float64) *PercentPosition
Percent sets the percent to the given value
func (*PercentPosition) Reverse ¶
func (pos *PercentPosition) Reverse(reversed bool) *PercentPosition
Reverse sets the reversed flag to the given value