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

Inconsistent position vector type between me.Renderable and base shape objects #817

Open
obiot opened this issue Sep 21, 2016 · 2 comments

Comments

@obiot
Copy link
Member

obiot commented Sep 21, 2016

Object pos type :

  • me.Ellipse : me.Vector2d
  • me.Polygon : me.Vector2d
  • me.Line : me.Vector2d
  • me.Rect : me.Vector2d
  • me.Renderable : me.ObscervableVector3d

Inheritance Chain :

  • me.Ellipse
  • me.Line <- me.Polygon
  • me.Renderable <- me.Rect <- me.Polygon

When attempting to clean the me.Renderable implementation, and removing the unnecessary bounds objets, this caused a lots of problems, because of the type mismatch.

Also, it might not be fully used (e.g. in the collision detection), and there will be still a mismatch as Renderables use a me.ObscervableVector3d object type, but all shapes should at least uses a me.Vector3d type for the position object.

Anyway clean way maybe to mutate a me.Vector3d object to a me.ObscervableVector3d one (using Object.assign?)

@obiot
Copy link
Member Author

obiot commented Sep 21, 2016

see also #709 , this should then be extended to all shapes constructor. (can come as a second step though)

@obiot
Copy link
Member Author

obiot commented Sep 27, 2016

another solution to this, that we discussed in the past as well, would be to reimplement me.Rect as a pure "box" object, that would then only be used for bounding box, and would be the base class for renderable (since ultimately, we also want to replace the child bounds, and use the renderable bounds as bounding box).

which would then give the following :
Object pos type :

me.Ellipse : me.Vector2d
me.Polygon :me.Vector2d
me.Line : me.Vector2d
me.Rect : me.ObscervableVector3d
me.Renderable : me.ObscervableVector3d
Inheritance Chain :

me.Ellipse
me.Line <- me.Polygon
me.Renderable <- me.Rect

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

No branches or pull requests

1 participant