Files
gonum/spatial/r2/deprecated.go
Sebastien Binet c9092a1e6a spatial/r2,all: harmonize r2.Vec API with r3.Vec API
Migration to the new API can be achieved with this rsc.io/rf script:

```
rf ex {
	import "gonum.org/v1/gonum/spatial/r2";
	var p,q r2.Vec;
	var f float64;

	p.Add(q) -> r2.Add(p, q);
	p.Sub(q) -> r2.Sub(p, q);
	p.Scale(f) -> r2.Scale(f, p);
	p.Dot(q) -> r2.Dot(p, q);
	p.Cross(q) -> r2.Cross(p, q);
	p.Rotate(f, q) -> r2.Rotate(p, f, q);
}
```

Updates gonum/gonum#1553.
2021-01-29 12:39:42 +01:00

50 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 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 r2
// TODO(sbinet): remove this file for Gonum-v0.10.0.
// Add returns the vector sum of p and q.
//
// DEPRECATED: use r2.Add.
func (p Vec) Add(q Vec) Vec {
return Add(p, q)
}
// Sub returns the vector sum of p and -q.
//
// DEPRECATED: use r2.Sub.
func (p Vec) Sub(q Vec) Vec {
return Sub(p, q)
}
// Scale returns the vector p scaled by f.
//
// DEPRECATED: use r2.Scale.
func (p Vec) Scale(f float64) Vec {
return Scale(f, p)
}
// Dot returns the dot product p·q.
//
// DEPRECATED: use r2.Dot.
func (p Vec) Dot(q Vec) float64 {
return Dot(p, q)
}
// Cross returns the cross product p×q.
//
// DEPRECATED: use r2.Cross.
func (p Vec) Cross(q Vec) float64 {
return Cross(p, q)
}
// Rotate returns a new vector, rotated by alpha around the provided point, q.
//
// DEPRECATED: use r2.Rotate.
func (p Vec) Rotate(alpha float64, q Vec) Vec {
return Rotate(p, alpha, q)
}