Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Jun 2008
Offline Last Active May 19 2013 05:53 AM

#5061495 Frustum Culling

Posted by on 13 May 2013 - 07:25 AM

Assuming you know the point of intersection (the corner) between PB and PL (let's call it PI), you can calculate a vector V = (P - PI). If (length(V) < sphereRadius) your point is inside, otherwise, check the dot product of normalized(V) with PB and PL plane normals, if and only if both values are negative, point is outside, if the comparison fails, it's inside.


Take this with a grain of salt since I've never tested or even considered this case when doing frustum culling, but this would be my first guess to solve this issue.


Hope it helped.

#5032723 stack vs heap

Posted by on 15 February 2013 - 11:18 AM

You can test it yourself, start by declaring a small vector and keep increasing it's size.


float hum[100000];

float hum[1000000];

float hum[10000000];


Eventually you'll reach a "segmentation fault" error.


I can't ensure you of this fact, since I could have done some wrong compiler configuration or my O.S (Ubuntu) deals with memory management in a different way, so I'll leave to more experienced programmers to elaborate on this. I had this issue once and it was very hard to figure it out.


Let me know what yo find.

#5032716 stack vs heap

Posted by on 15 February 2013 - 10:47 AM

Furthermore, stack memory should be avoided when dealing with large sets of data since most operating systems gives a limit for stack allocation (something in the order of 10mb from my experience), so if you try to declare an data array of size bigger than 10mb for example, your program will most likely crash.


Thought it would be worth mentioning since it's a bug very difficult to catch. I don't know what are the workarounds for that so I only use heap for large data allocation.