Jump to content

  • Log In with Google      Sign In   
  • Create Account

JohnnyLightwave

Member Since 11 Jul 2011
Offline Last Active Apr 20 2013 02:07 PM
-----

Topics I've Started

Following a path, determining when to move on to the next point

19 April 2013 - 04:18 PM

Hi all,

 

Using A*, I have an object that is following a list of points.

 

Because the object's speed and actual path is somewhat variable (it only follows the general vicinity of the points), I am looking for a good way to determine if it has passed one point and should move on to the next.

 

I thought I could do this with the dot product, to check the old vector toward the point with the new one, like so:

oldVector=objectTravelVector;
objectTravelVector=chasingPoint-objectPoint;
objectTravelVector.Normalize();

if (oldVector.Dot(objectTravelVector)<0) // Move to next point

It seems like that should work, but I am getting instances of my object circling points and refusing to move on to the next one.  It seems that if I pass the point, my dot product with the previous vector should be negative, and I just say, okay, next, point.

 

Am I doing this wrong?

 

 


Handling multitouch in Windows (like for Surface Pro)

08 April 2013 - 05:12 PM

Hi all, I have what I hope is a quick and easy question!

 

On iOS, multitouch is handled by giving each finger touch an ID... it's real simple, as you receive the touch callback, you just query for the ID too.

 

How is this done in Windows 8, for touch devices?  When I intercept WM_MOUSEMOVE or WM_LBUTTONDOWN, how can I determine the ID of the touch so I can properly handle them without confusing the two?

 

Thanks!

John


Interpolation of four points (grid corners)

18 February 2013 - 01:01 PM

Hi all,

 

Consider, if you will, this image:

http://i.imgur.com/xsZ6duv.png

 

Assuming that the four corners there have n value, I'm looking for a way to determine the best values for the red dots (or, actually, and point within the square).  I'm trying to determine light values at a finer grain than just finding the nearest corner and using it.

 

Is there a way to do this?  I tried simple linear interpolation combining both directions, but the results aren't satisfactory, so I think the way I thought up is fatally flawed.

 

Thanks for any help!

 

--JR

 


Booleans and Polygons

16 February 2013 - 12:09 PM

Hi all,

 

Can anyone direct me to a good resource about applying boolean operations to polygons?

 

I have a polygon that is basically a list of points.  There's three operations I want to do them:

 

1) Cut holes in them-- this would ideally produce two new polygons results for me, with a seam somewhere so I have two polygons that have dents in them that represent the hole.

 

2) Cut pieces of the edges out-- this would ideally produce just one result polygon, which would be identical to the original except with a bite taken out of it where the first one was.

 

3) Bisect a polygon.  The example of this would be if I had a polygon and then I had another polygon that crossed the whole polygon.  The result would be two polygons with the big bite taken out of the middle, not touching eachother.

 

I eventually have to triangulate the results.

 

I'm looking to write this routine myself, so that I can conform it to the quirks of my own polygon class.  At the same time, I'm not the kind of guy who understands pages and pdfs with equations and theory.  Is there a simple resource anywhere that explains this?

 

(Note: I've looked at several polygon libraries online that accomplish this.  I am looking for lightweight, since I don't need full boolean functionality, just subtraction)

 

Thanks!


SDL + XCode ... not linking?

14 January 2013 - 07:44 AM

Hi all,


First a caveat: I'm a windows programmer with only mild expertise on the mac.  I dev primarily on windows, and port to Mac.  So if you answer this question, you'll have to explain to me as if I were a child.

 

Now!  I recently discovered that the version of SDL that I'm using is incapable of doing fullscreen on OSX Lion.  Others say get the latest SDL, it's fixed.  So I got the latest SDL.

 

When I add SDL to my projects, I don't do anything special-- I grab SDL.framework, and drag it into my project, and it all "just works."

 

But with the most recent SDL, when I do this, it doesn't work.  The program crashes on startup with the message:

 

Library not loaded: @rpath/SDL.framework/Versions/A/SDL Referenced from:
/Users/USER/Desktop/*/MyApp.app/Contents/MacOS/MyApp 
Reason: image not found

I have limited XCode expertise.  I have tried removing SDL completely, re-adding it, adding it manually to the copy files and link with executable steps, all with the exact same results.  One note: I do NOT have SDL installed on my system, and never have.  I've always just used a copy of SDL.framework that I keep in my personal work folder, and never had any problems before.

 

Can anyone tell me what I'm doing wrong?

 

Again, to clarify: With my older version of SDL, it all works fine (but crashes on fullscreen).  If I replace the older SDL.framework with a copy of the newer one, that's when it all goes to hell.  Theoretically, nothing should have changed, right?


PARTNERS