Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: graphic card accelarator vs. FPGA: which is better for the following task?



"walala" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Dear all,
> 
> I guess this is a ray-tracing problem... But I need to do this task in as
> high as possible speed/throughput. Here is my problem:
> 
> Suppose I am given 25 rays and I am given a 3D cube and all parameters of
> these rays and cube are given...
> 
> I need to compute the length of the intersecting segment of the rays with
> this cube as fast as possible. If some rays completely fall outside of the
> cube, then it outputs 0, otherwise gives the length.

Let the cube be given by three normal vectors n1 to n3 and six points
p1 to p6 on the six planes.
(Actually you can use the same point multiple times)
Assume your rays start in the origin and are given by a vector r of
length 1.
Then the interscetions with the first plane happens at a distance d of
d1= n.p1/(n1.r)= n.p1 * (1/(n1.r))
See 
http://geometryalgorithms.com/Archive/algorithm_0104/algorithm_0104B.htm#Line-Plane%20Intersection
Then you order the planes according to d.
If the ray does not cross the three front planes first, the cube is
missed, otherwise the difference between the fourth and the third
distance is the length of the intersection.

So for each ray you get three devisions, four multiplications and a
couple of minmax cells.
(Many ore optimizations due to symmetries possible.)

With integers you should be able to do that in a small Spartan-III in
a pipeline a lot faster than you can get data into the chip.

With floating point numbers it should be still very fast in an FPGA,
but the design gets a lot more complicated and larger.

Have fun,

Kolja Sulimma



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.