func (vec *T) Add(v *T) *T {
	vec[0] += v[0]
	vec[1] += v[1]
	vec[2] += v[2]
	return vec
}
Add adds another vector to vec.
package vec3
import (
	"fmt"
	math "github.com/ungerik/go3d/fmath"
	"github.com/ungerik/go3d/generic"
)
var (
	Zero = T{}
	UnitX = T{1, 0, 0}
	UnitY = T{0, 1, 0}
	UnitZ = T{0, 0, 1}
	UnitXYZ = T{1, 1, 1}
	Red = T{1, 0, 0}
	Green = T{0, 1, 0}
	Blue = T{0, 0, 1}
	Black = T{0, 0, 0}
	White = T{1, 1, 1}
	MinVal = T{-math.MaxFloat32, -math.MaxFloat32, -math.MaxFloat32}
	MaxVal = T{+math.MaxFloat32, +math.MaxFloat32, +math.MaxFloat32}
)
type T [3]float32
func From(other generic.T) T {
	switch other.Size() {
	case 2:
		return T{other.Get(0, 0), other.Get(0, 1), 0}
	case 3, 4:
		return T{other.Get(0, 0), other.Get(0, 1), other.Get(0, 2)}
	default:
		panic("Unsupported type")
	}
}
func Parse(s string) (r T, err error) {
	_, err = fmt.Sscan(s, &r[0], &r[1], &r[2])
	return r, err
}
func (vec *T) String() string {
	return fmt.Sprint(vec[0], vec[1], vec[2])
}
func (vec *T) Rows() int {
	return 3
}
func (vec *T) Cols() int {
	return 1
}
func (vec *T) Size() int {
	return 3
}
func (vec *T) Slice() []float32 {
	return vec[:]
}
func (vec *T) Get(col, row int) float32 {
	return vec[row]
}
func (vec *T) IsZero() bool {
	return vec[0] == 0 && vec[1] == 0 && vec[2] == 0
}
func (vec *T) Length() float32 {
	return float32(math.Sqrt(vec.LengthSqr()))
}
func (vec *T) LengthSqr() float32 {
	return vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]
}
func (vec *T) Scale(f float32) *T {
	vec[0] *= f
	vec[1] *= f
	vec[2] *= f
	return vec
}
func (vec *T) Scaled(f float32) T {
	return T{vec[0] * f, vec[1] * f, vec[2] * f}
}
func (vec *T) Invert() *T {
	vec[0] = -vec[0]
	vec[1] = -vec[1]
	vec[2] = -vec[2]
	return vec
}
func (vec *T) Inverted() T {
	return T{-vec[0], -vec[1], -vec[2]}
}
func (vec *T) Abs() *T {
	vec[0] = math.Abs(vec[0])
	vec[1] = math.Abs(vec[1])
	vec[2] = math.Abs(vec[2])
	return vec
}
func (vec *T) Absed() T {
	return T{math.Abs(vec[0]), math.Abs(vec[1]), math.Abs(vec[2])}
}
func (vec *T) Normalize() *T {
	sl := vec.LengthSqr()
	if sl == 0 || sl == 1 {
		return vec
	}
	vec.Scale(1 / math.Sqrt(sl))
	return vec
}
func (vec *T) Normalized() T {
	v := *vec
	v.Normalize()
	return v
}
func (vec *T) Normal() T {
	n := Cross(vec, &UnitZ)
	if n.IsZero() {
		return UnitX
	}
	return n.Normalized()
}