mirror of
https://github.com/gonum/gonum.git
synced 2025-10-10 09:30:13 +08:00
spatial/r3: harmonize Vec API with num/quat.Number
Migration to the new API can be achieved with this rsc.io/rf script: ``` rf ex { import "gonum.org/v1/gonum/spatial/r3"; var p,q r3.Vec; var f float64; p.Add(q) -> r3.Add(p, q); p.Sub(q) -> r3.Sub(p, q); p.Scale(f) -> r3.Scale(f, p); p.Dot(q) -> r3.Dot(p, q); p.Cross(q) -> r3.Cross(p, q); p.Rotate(f, q) -> r3.Rotate(p, f, q); } ``` Updates gonum/gonum#1553.
This commit is contained in:
49
spatial/r3/deprecated.go
Normal file
49
spatial/r3/deprecated.go
Normal file
@@ -0,0 +1,49 @@
|
||||
// Copyright ©2021 The Gonum Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package r3
|
||||
|
||||
// TODO(sbinet): remove this file for Gonum-v0.10.0.
|
||||
|
||||
// Add returns the vector sum of p and q.
|
||||
//
|
||||
// DEPRECATED: use r3.Add.
|
||||
func (p Vec) Add(q Vec) Vec {
|
||||
return Add(p, q)
|
||||
}
|
||||
|
||||
// Sub returns the vector sum of p and -q.
|
||||
//
|
||||
// DEPRECATED: use r3.Sub.
|
||||
func (p Vec) Sub(q Vec) Vec {
|
||||
return Sub(p, q)
|
||||
}
|
||||
|
||||
// Scale returns the vector p scaled by f.
|
||||
//
|
||||
// DEPRECATED: use r3.Scale.
|
||||
func (p Vec) Scale(f float64) Vec {
|
||||
return Scale(f, p)
|
||||
}
|
||||
|
||||
// Dot returns the dot product p·q.
|
||||
//
|
||||
// DEPRECATED: use r3.Dot.
|
||||
func (p Vec) Dot(q Vec) float64 {
|
||||
return Dot(p, q)
|
||||
}
|
||||
|
||||
// Cross returns the cross product p×q.
|
||||
//
|
||||
// DEPRECATED: use r3.Cross.
|
||||
func (p Vec) Cross(q Vec) Vec {
|
||||
return Cross(p, q)
|
||||
}
|
||||
|
||||
// Rotate returns a new vector, rotated by alpha around the provided axis.
|
||||
//
|
||||
// DEPRECATED: use r3.Rotate
|
||||
func (p Vec) Rotate(alpha float64, axis Vec) Vec {
|
||||
return Rotate(p, alpha, axis)
|
||||
}
|
Reference in New Issue
Block a user