View Full Version: Lassie SuperSheep: peanut gallery may comment

lassie >>Lassie >>Lassie SuperSheep: peanut gallery may comment


<< Prev | Next >>

bigmac- 01-16-2008

Geeze John, you threw down the gauntlet. While hanging out to look after my girlfriend (who is feeling under the weather) this evening, I got thinking about the geometry involved in hit--*test*-('")ing quadrilaterals. Doh! It's friggin' simple. So I wrote the program. At the heart it just involves an angle object that will -*test*-('") if a point is contained within the range of its angle. Then, all a quadrilateral is is a figure with four angles. If a point is contained within each of those four angles, the hit is confirmed. HOWEVER. One fatal flaw... this breaks when the figure is reduced to less than a triangle. Say you stretch one point into the center of the quad so that the quad makes an "L" shape. No good, the angle -*test*-('") doesn't work. So, that taught me why you never see these sorts of geometry editors support quads. They don't work. What you have to use are triangles, which never break... and two triangles with a common side make a quadrilateral, right? So, I'm not saying that I'm implementing quad geometry in the Lassie walkable area. I'm not saying that YET. However, I conveniently have all the math written for it now. And should I decide to implement it, it will probably utilize triangles rather than quadrilaterals.

JohnGreenArt- 01-16-2008

Woo!

bigmac- 01-17-2008

Oh yeah... I forgot. Hit -*test*-('")ing a quad is only half the battle. Lassie also uses boxes to interpret a background-click into the scope of a motion-safe area. That requires interpolating points based on geometry. This is pretty straight forward with rectangles. I'm not entirely sure how to do that with polygons, but I suspect the answer lies in triangle incircles... good old wikipedia gave me some insight this morning with a quick search: http://en.wikipedia.org/wiki/Incircle this is why Lassie has (and for the time being) will continue to only support rectangles. Course, I do love geometry so never say never... but for the time being, don't get your hopes up.

SeanCyrusTowel- 01-17-2008

Now it's the Mathematicians turn to shine.... I think you are looking at it slightly the wrong way (which is the largest problem when it comes to math).... Don't look at a quadrilateral as two triangles with a common side, look at it as a rectangle, with four (or up to 8) triangles sharing 2 sides with the rectangle (I'll draw a pic tonight when I get home). Point is, if you can point -*test*-('") a right triangle, and can work with the angle, it shouldn't be a problem. Again this should make more sense when I have a diagram drawn tonight. *Edit* just drew myself a diagram at work.... This might need a little more thinking through.... I think it's the right way to go.... but it's still tough to figure out. Though maybe adding basic right triangles as a walkable area will help at least the person making the game create their own quads. (If lassie broke it down, it'd be faster for all but you Greg) *Edit 2* after a few more minutes of drawing on a larger piece of paper, I think it would just be a recursive function.... I'll explain later

JohnGreenArt- 01-17-2008

Heck, even if it was limited to rectangles and right triangles, that'd be OK with me.

bigmac- 01-17-2008

I was thinking incircles along these lines. Ultimately we need to solve for the the length of leg X... > So, we know legs A, B, and C. We know angles q and r, and so know p and s due to bisection. We can figure out the total of the inner angle at the blue point, and the value of the bisected angles created b leg X. However, we still need to find the length of X, which is the radius of the greater triangle's incircle. So, I'm looking around for that formula. It looks like it was probably on that Wikipedia page.

NigeC- 01-17-2008

Didn't the Scumm engine use hexagon :idea: What do i know.. i twiddle bits of wire together for a living :lol:

bigmac- 01-17-2008

Heck, even if it was limited to rectangles and right triangles, that'd be OK with me. Right triangles don't solve the problem of point interpolation; though it would make it easier since you would have some regulatory grounds to base calculations upon. However, it doesn't change the fact that as soon as you break from regular axis, you're making life much more difficult to plot point assumptions within. However, we're beyond the practical nature of this problem and onto the principal of the thing. :D

SeanCyrusTowel- 01-17-2008

Hmmmm, I was just thinking along the lines of point/shape intersection.... As near as I canfigure you can break down any quadrilateral (and probably any polynomial) into a number of (that number seems to increase past my former estimate of 8, when you get complex quadrilaterals). Using those right triangles, should make it easier to determine whatever you are looking for withing the box, wheather it's for intersection, or just movement of the character. Again, I will draw up some pictures tonight to post about it... but assuming you can take a point, and determine if a line from that point intersects (and where) a line made by two other points, it wouldnt' be too hard for the computer to calculate.

SeanCyrusTowel- 01-17-2008

Oh and now that SuperSheep has been announced, do I get to be an admin again? Oh and let me explain a little why I would like to see quadrilaterals supported. Once quadrilaterals are supported, you might as well support polygons, because any polygon can be split into a number of quads and triangles. So if this can be worked out, it'll make it a lot easier to support more than that. Another thought I had while I was eating dinner, (directed at Greg) remember when we did Isle of the Maneaters? Remember how we made links for the doorways that were polygons. Why not look at some sudo code (or something) for a web browser, and see how they figure that information out... would be a similar design (though I may be stuck on the idea of registering if one is clicking in the area, and not how to move there)

fatbuoy1- 01-17-2008

Greg, my trigonometry is a little hazy, but does X cut A in half exactly? Because then you can use c² = a² + b² - 2ab cosC or in this case, X² = (A/2)² + C² - 2 (A/2)² (C) (cos r) to find X?

SeanCyrusTowel- 01-17-2008

no, x does not cut A exactly in half

fatbuoy1- 01-17-2008

Well THATS unfortunate! :P

SeanCyrusTowel- 01-17-2008

lol, yeah.... (sorry that sounded kinda.... whats the word I want... pushy?) Although I do believe X is the radius of the circle

fatbuoy1- 01-17-2008

Yeah it is. Well for the law of cosines to work we jus need a, which is the distance from where X dissects A, to the corner which contains the angles r and s... yes? Take a look at this image http://en.wikipedia.org/wiki/Image:Circle-trig6.svg As far as I can see, what we are looking for is noted as AE in this diagram... while X is noted as AO. Does that make sense?

Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.