myrkos
|
  |
| Joined: 06 Sep 2010 |
| Total Posts: 8072 |
|
|
| 29 Nov 2011 09:46 PM |
I know quite a few capable people post here, so I might as well ask here.
So we have two vectors, what's the most efficient way to only get all the pixels on the line, which are whole numbers of course. Slopes don't always get all the pixels, though there may be a way to change the slope to do so. I haven't really done stuff like this before much, lol. |
|
|
| Report Abuse |
|
|
rayoma
|
  |
| Joined: 13 Nov 2009 |
| Total Posts: 1911 |
|
|
| 29 Nov 2011 10:17 PM |
> to only get all the pixels on the line, which are whole numbers of course.
pixels on a 3D line? |
|
|
| Report Abuse |
|
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
|
| 29 Nov 2011 11:16 PM |
It only has to APPEAR 3D. Look into perspective.
It's a love-hate relationship.... |
|
|
| Report Abuse |
|
|
myrkos
|
  |
| Joined: 06 Sep 2010 |
| Total Posts: 8072 |
|
|
| 29 Nov 2011 11:54 PM |
| I have looked into perspective, yet I'm asking something totally different. |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2011 12:26 AM |
| Do you mean voxels? Pixels do not exist in 3D space. |
|
|
| Report Abuse |
|
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
|
| 30 Nov 2011 01:30 AM |
Oh, never mind. I would suggest slope.. + math.
It's a love-hate relationship.... |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2011 06:13 AM |
| First, you would move the points to 2D, draw the line using whatever algorithm, and for each pixel you would take its position on the 2D line and move it back to 3D |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2011 06:14 AM |
Nowait...
Youre wanting to draw a line or wat?
In that case u google "best line rasterizing alg0rithm pl0x" |
|
|
| Report Abuse |
|
|
myrkos
|
  |
| Joined: 06 Sep 2010 |
| Total Posts: 8072 |
|
|
| 30 Nov 2011 09:31 AM |
Kthx.
So Bresenham's algorithm seems to be the simplest. |
|
|
| Report Abuse |
|
|
| |
|
pighead10
|
  |
| Joined: 03 May 2009 |
| Total Posts: 10341 |
|
|
| 30 Nov 2011 11:59 AM |
| I have no idea what you are asking |
|
|
| Report Abuse |
|
|
HotThoth
|
  |
 |
| Joined: 24 Aug 2010 |
| Total Posts: 1176 |
|
|
| 30 Nov 2011 12:38 PM |
Not sure if you want voxels or pixels. Do you want an algorithm to step through all of the 1x1 3-dimensional cubic regions that the line crosses, or an algorithm to step through all of the 2D pixels on your screen that the line would cross given that your camera is at some particular position with a given field of view? My guess is the first, in which case, yes, you want some rasterization algorithm.
One way of approaching the rasterization problem from a geometric standpoint is to calculate ray/axis-aligned-bounding-box collisions (start with ray/plane collisions). Which rasterization approach to use depends on what type of line you want to get. For example: is it ok if the line steps from (0,0,0) to (1,1,1) or should it have to pass through other points first? |
|
|
| Report Abuse |
|
|
myrkos
|
  |
| Joined: 06 Sep 2010 |
| Total Posts: 8072 |
|
|
| 30 Nov 2011 05:09 PM |
Yeah, I meant voxels, which I guess can be considered as 3D pixels. :p
I figured though, that I could just project the beginning and end of the line to a 2D plane and then draw the rest of it in on the plane. Thanks though. |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2011 05:19 PM |
Holy crap
Ineedtolrntoscript |
|
|
| Report Abuse |
|
|