-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add functions from Vector3 to Vector2 and Vector4 #71
Comments
Hi @chapulina, I'd like to work on this issue. My plan is to work in the Vector2 first, and later, make the changes to Vector4. I have some questions:
Edit: Remove Your idea is to add all of these functions? Thank you! |
Thanks for tackling this!
That's good, since it's the one used from Blueprint. Then we will merge it forward to
Maybe some of them don't make much sense, such as
That sounds like a good plan. You definitely don't need to do all functions at once, feel free to group them in separate pull requests as you see fit. Also, don't feel like you need to address this whole issue - it's already a big help if you implement a subset of the functions. |
Hi @chapulina, I would like to work in this issue too. In your experience, what is the best way to divide work like that? I was thinking in take the Vector4 functions while @pxalcantara is at Vector2 functions, but I'm worried that the functions are similar and we end up doing rework. Like he did with Vector2, I compared Vector3 and Vector4 finding these functions that are present only in Vector3:
|
@luccosta I think we can do this way because the functions need to be added in both classes anyway, so I don't think that is reworked, let's do this way ;) |
@chapulina Thank you How about the size of each PR, one for each function is too small, or is ok? Since will have the function implementation and the Unit test for this function? |
@chapulina, here it goes the first small PR, how about the size, too small? The link of the contributing.md is off so I have no reference. To continue the implementations I have some questions.
Thanks! |
Signed-off-by: pxalcantara <[email protected]>
Thanks! I think that size works fine for us, it's quicker to review. It's usually a balance of how inconvenient it is for you to keep a bunch of parallel branches and how easy it is for us to review the PRs. In general, it makes sense to group similar functions, so you could put all the Min / Max functions together for example.
Good point, I think that
I think |
Ok, It sounds good but, what I meat about the implementation of So in the next implementation like "Set", as |
Signed-off-by: pxalcantara <[email protected]>
Oh yes, I looked too quickly and didn't notice that. There's an issue for that, #34 . I think it can be considered out of the scope for this issue and you can follow up there if you're interested.
Ok, I see the issue here now too. I vote for the new |
Humm, nice! I agree that it is out of the scope for this issue!
I like the proposal of |
Signed-off-by: pxalcantara <[email protected]>
Now I'm gonna work in the functions:
|
I agree; that sounds good |
Now I'm gonna work in
|
Hi @chapulina, I would like to work in this issue too. I taked with @pxalcantara and I will implement the following functions:
|
- Abs() => Get the absolute value of the vector - AbsDot() => The absolute dot product - Correct() => Corrects any nan values Create unit test for all functions. Did all checks and tests. These functions intend to solve issue gazebosim#71 Signed-off-by: Felipe Ximenes <[email protected]>
- Abs() => Get the absolute value of the vector - AbsDot() => The absolute dot product - Correct() => Corrects any nan values Create unit test for all functions. Did all checks and tests. These functions intend to solve issue gazebosim#71 Signed-off-by: Felipe Ximenes <[email protected]>
- Abs() => Get the absolute value of the vector - AbsDot() => The absolute dot product - Correct() => Corrects any nan values Create unit test for all functions. Did all checks and tests. These functions intend to solve issue gazebosim#71 Signed-off-by: Felipe Ximenes <[email protected]>
- Abs() => Get the absolute value of the vector - AbsDot() => The absolute dot product - Correct() => Corrects any nan values Create unit test for all functions. These functions intend to solve issue #71 Co-authored-by: Alejandro Hernández Cordero <[email protected]> Signed-off-by: Felipe Ximenes <[email protected]>
In research I found that |
The Vector3::operator< implementation dont make much sense for me. This type of comparison wouldn't match better a length comparison? As implement in other way breaks the initial objective of the Issue to getting a consistent API across vector classes, I will implement equally for now. |
As |
I see this issue is still open. I'd also like to contribute to this issue. @pxalcantara @luccosta @chapulina I'd like some guidance as to which functions do I start working on? |
Hi @akshatpandya Really nice. I the beginning of the post there is a list of functions that should be implemented from Vector3 to Vector4 class. I think you can start for anyone that is not implemented yet and you feel comfortable with it. If you'd like to work on Round() or Rounded(), just take a look at the conversation that starts here about the implementation method. |
Thanks for the reply, @pxalcantara . I'll start with the list above to implement from Vector3 to Vector4 class. What do you think? Just like the Normal() in Vector3 that gives normal to 3 Vector3 points, we can give normal to 5 Vector4 points (pentagon). |
@akshatpandya Apparently the functions are already implemented in Vector4, here, so, would be better to work on Vector2 list |
@pxalcantara Cool, I start with Round() and Rounded() for Vector2. |
@akshatpandya Saturday will happen this event to collaborate together with the Ignition. It'll be really nice to see you there 👍 |
- Round(): Rounds to nearest whole number inplace - Rounded(): Returns a rounded version of the vector Created unit tests for both functions. colcon build --merge-install [PASSED] colcon test --merge-install [PASSED] Intend to solve issue ignitionrobotics#71 Signed-off by: Akshat Pandya <[email protected]>
- Round(): Rounds to nearest whole number inplace - Rounded(): Returns a rounded version of the vector Created unit tests for both functions. colcon build --merge-install [PASSED] colcon test --merge-install [PASSED] Intend to solve issue ignitionrobotics#71 Signed-off-by: akshatpandya <[email protected]>
- Round(): Rounds to nearest whole number inplace - Rounded(): Returns a rounded version of the vector Created unit tests for both functions. colcon build --merge-install [PASSED] colcon test --merge-install [PASSED] Intend to solve issue ignitionrobotics#71 Signed-off-by: akshatpandya <[email protected]>
@chapulina Since the implementation of the methods Perpendiculer, Normal, and DistToLine needs the implementation of the |
Distance to lineI think this can be implemented in a way that's specific to 2D. Here are some hints for distance to line (which in our case is a segment defined by 2 vectors). Special care is needed when the point's projection onto the segment is outside of it. NormalI think this can also be implemented specifically for 2D. There are some leads here for how to do it. I think we should be sure to normalize the result. Special care needs to be taken with the direction of the normal. For a triangle it's well defined by the right-hand rule. PerpendicularOur documentation for |
@chapulina I understand that "Distance to Line" can be implemented for Vector2. For Normal:Our convention is to return a vector normal to a triangle. Which means, a vector perpendicular to a plane. Such a vector has to be defined by Vector3. For Perpendicular:Currently we are returning an orthogonal vector. For Vector2, this can be implemented (from here. So I think we can currently implement, distance to line and perpendicular. And think of what normal would mean for Vector2. |
Yeah I think the equivalent in 2D would be a unit 2D vector that defines the perpendicular to a line segment defined by 2 points.
If we're talking about unit vectors, then I think a normal is probably better defined, like I said above.
The problem with the implementation for Vector3 is that it returns just one of infinite possibilities. For example on the first test case above, the perpendicular for |
Original report (archived issue) by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).
For example, there is a Vector3::Normalized, but no such function for Vector2 or Vector4. The same goes for
Round
,Rounded
and other functions.IssueForNewDevelopers
The text was updated successfully, but these errors were encountered: