mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-10 18:47:23 -05:00
* Fixed nil pointer in Copy() * Position added Added Floor() and String() methods to Vector. Also added Position which declares an embedded Vector2 and returns various forms of it. * Position tests improved
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package d2interface
|
|
|
|
import "math/big"
|
|
|
|
// Vector is a 2-dimensional vector implementation using big.Float
|
|
type Vector interface {
|
|
X() *big.Float
|
|
Y() *big.Float
|
|
Marshal() ([]byte, error)
|
|
Unmarshal(buf []byte) error
|
|
Clone() Vector
|
|
Copy(src Vector) Vector
|
|
// SetFromEntity(entity WorldEntity) Vector
|
|
Set(x, y *big.Float) Vector
|
|
SetToPolar(azimuth, radius *big.Float) Vector
|
|
Equals(src Vector) bool
|
|
FuzzyEquals(src Vector) bool
|
|
Abs() Vector
|
|
Angle() *big.Float
|
|
SetAngle(angle *big.Float) Vector
|
|
Add(src Vector) Vector
|
|
Subtract(src Vector) Vector
|
|
Multiply(src Vector) Vector
|
|
Scale(value *big.Float) Vector
|
|
Divide(src Vector) Vector
|
|
Negate() Vector
|
|
Distance(src Vector) *big.Float
|
|
DistanceSq(src Vector) *big.Float
|
|
Length() *big.Float
|
|
SetLength(length *big.Float) Vector
|
|
LengthSq() (*big.Float, *big.Float)
|
|
Normalize() Vector
|
|
NormalizeRightHand() Vector
|
|
NormalizeLeftHand() Vector
|
|
Dot(src Vector) *big.Float
|
|
Cross(src Vector) *big.Float
|
|
Lerp(src Vector, t *big.Float) Vector
|
|
Reset() Vector
|
|
Limit(max *big.Float) Vector
|
|
Reflect(normal Vector) Vector
|
|
Mirror(axis Vector) Vector
|
|
Rotate(delta *big.Float) Vector
|
|
Floor() Vector
|
|
String() string
|
|
}
|