Skip to content
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

Primitive operations on Points #171

Closed
Michael-F-Bryan opened this issue Sep 26, 2017 · 5 comments
Closed

Primitive operations on Points #171

Michael-F-Bryan opened this issue Sep 26, 2017 · 5 comments

Comments

@Michael-F-Bryan
Copy link
Contributor

I just noticed there isn't an impl for multiplying/dividing a Point<F> by F. Has this been left out on purpose?

My specific use case is creating a unit vector. My current code looks like this

let magnitude = other.dot(&other);
let unit_v = Point::new(other.x() / magnitude, other.y() / magnitude);

However it'd be nice if I could skip the Point::new() call and just do something like this:

let magnitude = other.dot(&other);
let unit_v = other / magnitude;
@urschrei
Copy link
Member

I've implemented the same functionality you describe in a couple of places, and used Point interchangeably as a vector, although I don't feel great about it. We should probably just have a vector type – I'm already getting confused when I look at function signatures that are doing vector ops.

@Michael-F-Bryan
Copy link
Contributor Author

That's a good point, although what's the difference between a Point and a Coordinate? My thoughts were that Point is actually a generic 2D vector, whereas Coordinate is a thing which has a x and y and denotes positions.

That said, Coordinate is essentially useless at the moment...

@urschrei
Copy link
Member

Point is actually a generic 2D vector

Hmm. I think this depends on the model, but I'd consider points to represent an absolute position in space, without any other dimensions. Which also describes Coordinate, I realise. The Point / Coordinate distinction precedes my existence in rust-geo, but I know this question's come up before.

@frewsxcv
Copy link
Member

That said, Coordinate is essentially useless at the moment...

For the record, there was some discussion here: #15

@michaelkirk
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants