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

Box2n and Box3n cleanup #920

Merged
merged 16 commits into from
Jun 6, 2019
Merged

Box2n and Box3n cleanup #920

merged 16 commits into from
Jun 6, 2019

Conversation

frederikja163
Copy link
Member

@frederikja163 frederikja163 commented May 30, 2019

Purpose of this PR

  • Cleanup of the box geometries and re-implementing them so they are now bi-vector based instead.
  • Targets OTK.Math

Testing status

  • Tests will be written in a sub PR as this PR is currently blocking as add Box3 #919 was not stylecop compliant (woops)

Comments

@frederikja163 frederikja163 changed the title Box2n and Box3n cleanup [WIP] Box2n and Box3n cleanup May 30, 2019
Copy link
Member

@varon varon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good progress, keep it up!

src/OpenToolkit.Mathematics/Geometry/Box2.cs Outdated Show resolved Hide resolved
src/OpenToolkit.Mathematics/Geometry/Box2.cs Outdated Show resolved Hide resolved
src/OpenToolkit.Mathematics/Geometry/Box2.cs Outdated Show resolved Hide resolved
src/OpenToolkit.Mathematics/Geometry/Box2.cs Outdated Show resolved Hide resolved
src/OpenToolkit.Mathematics/Geometry/Box2.cs Outdated Show resolved Hide resolved
@@ -208,7 +189,7 @@ public override int GetHashCode()
/// <inheritdoc/>
public override string ToString()
{
return string.Format("({0}{4} {1}) - ({2}{4} {3})", Left, Top, Right, Bottom, ListSeparator);
return string.Format("({0}{4} {1}) - ({2}{4} {3})", Min.X, Min.Y, Max.X, Max.Y, ListSeparator);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably display it as position/size as that's a lot easier to reason about.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does go back to the, do we want min/max, throughout or do we want position/size. I think it makes more sense to have min/max, as this is how the rest of the box2 is structured by now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw this is still relevant, however the structure has changed from using String.Format to using a string like this $""

@frederikja163 frederikja163 mentioned this pull request Jun 2, 2019
Copy link
Contributor

@Perksey Perksey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just merged #919. Fix all the review comments that were in there, and also fix build as I noticed that it's failing. Probably StyleCop's fault...

Copy link
Member

@varon varon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all of this! Still a bit to go, but we're getting there!

src/OpenToolkit.Mathematics/Geometry/Box2.cs Outdated Show resolved Hide resolved
else
{
_min.X = value.X;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest we use clamping instead of if/else for these.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't exactly get what you mean by that. And clamping would have the same branch count...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried making them work with clamping but i couldn't any suggestions on how to do this?

src/OpenToolkit.Mathematics/Geometry/Box2.cs Outdated Show resolved Hide resolved
src/OpenToolkit.Mathematics/Geometry/Box2.cs Outdated Show resolved Hide resolved
src/OpenToolkit.Mathematics/Geometry/Box2.cs Outdated Show resolved Hide resolved
src/OpenToolkit.Mathematics/Geometry/Box2.cs Outdated Show resolved Hide resolved
src/OpenToolkit.Mathematics/Geometry/Box2.cs Outdated Show resolved Hide resolved
src/OpenToolkit.Mathematics/Geometry/Box2.cs Outdated Show resolved Hide resolved
@frederikja163 frederikja163 changed the title [WIP] Box2n and Box3n cleanup Box2n and Box3n cleanup Jun 6, 2019
? point.Y >= Top != point.Y > Bottom
: point.Y > Top != point.Y >= Bottom;
var newDistMax = (anchor - _max) * scale;
_max = new Vector2(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that really stylecop conform?

@varon
Copy link
Member

varon commented Jun 6, 2019

Note that this hasn't been significantly reviewed, but merging as it fixes broken master.

@varon varon merged commit 98ff23b into opentk:master Jun 6, 2019
@frederikja163 frederikja163 mentioned this pull request Jun 6, 2019
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 this pull request may close these issues.

None yet

6 participants