JacquesCarette / Drasil

Generate all the things (focusing on research software)
https://jacquescarette.github.io/Drasil
BSD 2-Clause "Simplified" License
142 stars 26 forks source link

Please review the new Instance Model (IM4) for game physics. #1207

Closed oluowoj closed 5 years ago

oluowoj commented 5 years ago

@smith, as discussed SRS is located @ https://github.com/smiths/caseStudies/tree/gamephy_finaldoc/CaseStudies/gamephys/docs/SRS.

Please let me know if it makes any sense to you before I proceed with adding it on Drasil.

smiths commented 5 years ago

@oluowoj, for your T5 (Collision Detection) we want to actually have an equation. Something like the following:

CodeCogsEqn

In the description you can clarify that we have a sequence of bodies B. Each body is made up of a set of points in space. The set of points changes as the body moves. Two bodies have collided if they have intersection of their sets of points.

This will only bring us part way to what we eventually need. Knowing there is a collision is only part of the story. What we really need is to return the collision point or points. We should have an invariant that two bodies never actually intersect, so in our 2D examples we shouldn't have an area of intersection. Intersections can either be at a point, or on a line. We really should return the points and lines that intersect.

This discussion highlights that our SRS is missing more information. What is a point? a line? a body? These things are implicitly assumed, but not made explicit. At some point we need to have another serious pass over this document, but I don't think now is the time for this. We should discuss this with @JacquesCarette when we are planning for your tasks going forward. (We also need to discuss whether we have a sequence of bodies, or the more general set of bodies. The literature on game physics always talks about a sequence, as far as I can tell, but this seems like a programming idea, not an abstract view of the problem.) My instinct is that we don't want to get too distracted at the moment and that we are better off proceeding with the bigger picture stuff.

My advice is to fix T5 along the lines I have explained above. We can worry about the other things I mentioned later. It will also become easier to write the SRS when we introduce the notion of types to our specifications. (It would be nice to have a type for points, lines, etc.)

Your IM4 (Collision detection of rectangles) also needs some work. Can you please make the following changes:

IM4 also highlights that we really will eventually need the notion of a body. I know what you mean by rect_1.x1, but this isn't really defined anywhere.

smiths commented 5 years ago

Since the review has been complete, I am going to close this issue. @oluowoj, if any questions come out of my review, please feel free to create new issues.

oluowoj commented 5 years ago

@smiths as per T5(Collision Detection), I was working on that yesterday, but to define collision detection as a TM, it requires an equation, as per our last discussion we are currently unable to write this equation in Drasil.

Also, as per defining: "What is a point? a line? a body?" Should these be in terminologies? We already have rigid body defined, so that covers the body, so maybe we just need to define a line and a point?

Asking the same question in a different way.....Do you see 'point' GN or TM? How do you intend defining these in Drasil?

smiths commented 5 years ago

@oluowoj, let us start with defining points and lines in terminology. That matches with where rigid bodies are defined.

oluowoj commented 5 years ago

Point : An exact location. It has no size, only position. Line: A line in the plane is often defined as the set of points whose coordinates satisfy a given linear equation.

@smiths, do these definitions match what you expect?

oluowoj commented 5 years ago

https://www.mathsisfun.com/definitions/point.html

smiths commented 5 years ago

Yes @oluowoj, these definitions are good for our current needs. I think in the long run we will need a more mathematical definition. In particular, lines might eventually need to be defined as two connected points (or equivalent) and shapes may need to be defined as a sequence of lines (or points). Now isn't the right time for that though. Please add the definitions that you have suggested.

oluowoj commented 5 years ago

Found a better definition from here: A line is an interval between 2 points https://www.britannica.com/science/line-mathematics

smiths commented 5 years ago

Okay, we can go with this definition. Can you please also cite the encyclopedia reference that you have used. This will be good information if this discussion point should come up again in the future.

oluowoj commented 5 years ago

Sure, I will add a comment for each definition