laserswald / camden-robotics

FRC Robotics code for Camden County High School: Team 3329
Other
3 stars 2 forks source link

Refactor Vector2 #11

Closed laserswald closed 13 years ago

laserswald commented 13 years ago

I'd like Vector2 to be an interface. Perhaps made into CoordinateVector, with PolarVector and CartesianVector as subclasses. Sound good to you?

theNerd247 commented 13 years ago

It's really not needed to do all this sub-classing. If Vector2 would be an interface then it would be over kill in the coding area. Plus with the math we will be doing its easiest to handle robot-heading and articulate positions as just one unit because alot of conversions between polar and Cartesian are going to be needed.

laserswald commented 13 years ago

It should work fine: just manipulate the vectors as CoordinateVectors. If you need a specific type of vector then pass the CoordinateVector to the constructor of the other vector. When will we need Cartesian coordinates, exactly? Keeping them under one interface but them actually being of a specific type will allow some freedom and a bit faster speed. We will only need to store 2 doubles at a time; not four.

On Tue, Nov 22, 2011 at 7:22 PM, theNerd247 < reply@reply.github.com

wrote:

It's really not needed to do all this sub-classing. If Vector2 would be an interface then it would be over kill in the coding area. Plus with the math we will be doing its easiest to handle robot-heading and articulate positions as just one unit because alot of conversions between polar and Cartesian are going to be needed.


Reply to this email directly or view it on GitHub:

https://github.com/laserdude11/camden-robotics/issues/11#issuecomment-2843173

theNerd247 commented 13 years ago

Cartesian coordinates are going to be needed for robot positioning and motion profiling. Polar coordinates are going to be needed for alot - can't pull much off the top right now. But wouldn't it just be easier to treat things as one vector instead of doing alot of conversion? It would be a large benefit especially when it comes to debugging - it would suck to come out that the robot doesn't work because of a conversion issue (also the math is so much easier to work with without converting).

laserswald commented 13 years ago

well see if you look at your code, you were doing just as much conversion as I was- I think more, actually. You really can't get around the fact that we need to convert it, so I'm just making things a bit easier for us in the future.

I figured since we are using polar more than cartesian, I made CoordinateVector lean a bit toward the Polar side. Polar coordinates make more sense when we are driving and moving a radial arm anyway. If we need a cartesian vector (Using them in dot products comes to mind, since multiplying and adding are much faster than arctanning and the like), we can convert it. No biggie. It'll be fine, bro. We can squeeze CPU cycles later.

theNerd247 commented 13 years ago

OK. I'll give....just try and stick to a few classes..

laserswald commented 13 years ago

Why would we need more coordinate systems? EVER?

theNerd247 commented 13 years ago

No I meant more classes to work with these.... never mind......i see a troll....