-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spatial/r3: Transformer interface and scope of r3 package #1809
Comments
When the package was designed it was not intended to be something bigger than storing spatial information for statistical methods and rendering static spatial data; this explains the reason that it is the way that it is. It looks like it is growing significantly in scope with the new additions. If it is going to grow into a generalised set of spatial data packages (I'm not opposed to this, but it brings additional complexity and already seems to be happening) then how it looks should be discussed. On the plus side of the discussion, it adds the possibility of easily supporting dualquat/dualcomplex transformations to r2 and r3. I think the name of the interface needs work. |
On names, I'd suggest To start the discussion, it would be helpful if you could outline where it is that you want to take the package(s) (if r3 moves, then r2 needs to as well to maintain API congruence) and what are the motivations for the extension. This can happen at gonum-dev if you want to flesh things out. |
Yes! I had been thinking just that the other day. I'll apply this change to the As for the end goal/future additions I do have a few comments: I envision gonum/r3 as being a solid but basic foundation to build 3D data manipulation programs. About the shape types
This may seem like a slippery slope: we add Transform/AffineI feel More spatial primitivesI'd really like to have an exported |
Do you have a concrete project in mind?
No, I agree, the 2-simplex and 3-simplex satisfy the needs of r2 and r3 (r3 requiring both if
Note that there are implications with graph here (see @vladimir-ch's work here that handles data needed to represent meshes). |
I have actually been working with these types on a playground styled project for testing out ideas https://github.com/soypat/go-play3d. So far it has helped me create the stl to sdf import function and start work on a tetrahedral sdf mesher. I have created the tetrahedrons using a similar datastructure to dcel. I use the
I agree plane data is already contained in Triangle, though there are memory and performance costs to using the |
These are a few more functions that I'd like to have in gonum which I forgot to mention. These are commonly used in 3D algorithms (sorry about the informality of these proposals). // Hessian returns the hessian matrix of a scalar field defined by f
// about a point p. tol defines the discretization step used to approximate
// the hessian.
func Hessian(p Vec, tol float64, f func(Vec) float64) *Mat // Method on *Mat?
// https://en.wikipedia.org/wiki/Gradient
func Gradient(p Vec, tol float64, f func(Vec) float64) Vec
// Jacobian returns the jacobian matrix of a vector field...
// have had no real use for this one yet but is here for completeness.
func Jacobian(p Vec, tol float64, f func(Vec) Vec) *Mat // Method on *Mat? Edit: Divergence was missing here // https://en.wikipedia.org/wiki/Divergence
func Divergence(p Vec, tol float64, f func(Vec) Vec) float64 |
I think this needs discussion; gonum-dev would be better that here. Hopefully we can get some others to contribute to thinking about this because it's a large set of changes that significantly changes the focus of the package. After that a formal proposal with a plan of the API explcitly described would be good to prevent scope creep. I'm not against this (next to graph things, spatial things are a thing that I enjoy playing with, but this is partly why I'm reluctant to just say yes here because I'm concerned about my own biases). |
More complete interface: type Transformer interface {
Apply(Vec) Vec
// Returns the inverse transform of Transformer
Inv() Transformer
} |
Is it too late to consider the following change to r3? Feel like a huge opportunity was missed when naming the Rotate method for Rotation. This would really simplify things on my end for the
sdf
package.Suggest adding
Apply
method and markingRotate
as deprecated as was done withVec
methods.The text was updated successfully, but these errors were encountered: