 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
> Appreciate you tracking that down for me.
>
Sent
ingo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
@Ingo: Thank you!
@all: In addition to:
> (*) I have made a list of 16 different types of rays to test, and want to
> parameterize them so that I can just auto-calculate rays for any cylinder
> parameters I enter.
>
> (1) Ray parallel to cylinder axis, which misses the cylinder
> (2) Ray that is skew/perpendicular to cylinder axis which misses the cylinder
> (3) Ray parallel to cylinder axis, which intersects the cylinder edge
> (4) Ray that is skew/perpendicular and that intersects tangentially
> (5) Ray parallel to cylinder axis, which intersects the cylinder inside
> (6) Ray that is skew/perpendicular and that intersects inside
> Diagonal rays that:
> (7) hit the bottom end cap, then the top end cap (non-perpendicularly)
> (8) hit the cylinder then the bottom end cap
> (9) hit the top end cap then the cylinder
> (10) hit the cylinder then the top end cap
>
> (11) Ray that is parallel to bottom end cap and misses
> (12) Ray that is parallel to bottom end cap and intersects
> (13) Ray that is parallel to top end cap and misses
> (14) Ray that is parallel to top end cap and intersects
> (15) Ray that clips a bottom corner
> (16) Ray that clips a top corner
I also have to create cases starting on the surface of the cylinder as well as
originating from the interior of the cylinder.
- BE
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
> So at present, I believe that I have code that reliably tests for intersections
> with the infinite cylinder, and once I fix the issue with the end caps, then I
> will begin to run some comprehensive tests. (*)
Well, that took way longer than it should have.
It would have probably gone a lot faster if I wasn't stupid and if the paper
explained the code better, or wrote it in a way that showed the pairing of
functions in a use case.
Once I hunted down why everything seemed half-right, upside-down, and
inside-out, I finally got the bounded cylinder to render without any residual
infinite cylinder hits.
> After that, I can either let you look over and test the code on your own, or I
> can work on plugging it into the Section 3.9 raytracer as a function call.
I kinda got a rectangle, which I'm optimistically hoping was my cylinder.
I was still using radius and other data from the sphere sample raytracer, and
when I "fixed" that, I get a black render.
However, now I just have to debug the function call and subsequent calculations,
and I'm hoping to get an actual homemade render soon.
Here's my SDL test scene shooting a bunch of rays from a grid, all having the
same direction vector, and showing missed rays (red), entry hits (green), and
exit hits (blue).
I think it's good enough to begin testing the Catmull-Rom bounding.
- BW
Also, there is a mouse in my kitchen.
Happens every year around this time. :\
Post a reply to this message
Attachments:
Download 'graphicsgemslinecylinderintersection.png' (218 KB)
Preview of image 'graphicsgemslinecylinderintersection.png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 10/23/25 09:51, Bald Eagle wrote:
> "Bald Eagle" <cre### [at] netscape net> wrote:
>> William F Pokorny <ano### [at] anonymous org> wrote:
>>
>>> 1) I cannot find 'D = ray.Direction;' in my yuqk code? Where and in what
>>> version of source code are you seeing this?
>>
>> Right because that line is not explicitly there.
>> D is implicitly defined as the ray direction.
>>
>> Then in line 256 we do: len = D.length();
>>
>> Which is why we need to get rid of the y component for reasons explained.
>>
>> So really what we need is an extra line that REdefines the _projected_ ray
>> direction as D = <D.x, 0, D.y> before that length and normalization take place.
>>
>> - BW
>
> https://news.povray.org/web.68e8688f251da1bc1f9dae3025979125%40news.povray.org
>
> "2. The issue (*) above was a result of the ray direction being used as-is.
> When I had an angled ray, the length was too large, and overly shortened my
> perpendicular vector.
> When I only used the ray projection onto the xz plane, all of my perpendicular
> vectors were of the proper length."
>
Thanks Bill.
I think the normalization - including y - is necessary for other reasons
like the generation of the polynomials, but I also believe I see your
point about what is needed for the initial bounding cylinder check,
specifically. I'll try with branch-off code which drops the 'y'
component for the initial cylinder test only.
Aside: I'd make a moderate bet this tangled with the issues I had in
some rotation about x tests where parts (partial segments/intervals) of
the sor would drop out. IIRC, those tests included negative on curve
(between end control points, points). We'll see.
Bill P.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
once I fix the issue with the end caps, then I
> > will begin to run some comprehensive tests. (*)
>
> Well, that took way longer than it should have.
The issues here were that it was unclear how and when each function should be
called, and in what order.
There were some issues with the signs of normals and dot products.
And then there was the issue with hits on the end cap that should have replaced
the hit on the infinite cylinder.
And clipping of the edge between the cylinder end cap was leaving residual hits.
So there were 4 places that I needed to add code to undef the results of the
infinite cylinder intersection test.
After that, I kinda needed to write a 3rd macro to take everything and assemble
the output of the 2 macros.
A cautionary tale here is that you have the math and geometry, the code that you
write to do it all, and then the code that you write to interpret and visualize
the result.
Don't go chasing bugs in the first two parts, if the problem is in the third
part.
> However, now I just have to debug the function call and subsequent calculations,
> and I'm hoping to get an actual homemade render soon.
That might not get done until the weekend, when I have another 5 straight hours
to scroll back and forth through the code, inventing new expletives until I
finally get something to work.
Stage One is where all of the things in the code get pondered and picked at.
Even if it's the code I wrote myself.
Stage Two is where a "sense" of deeper understanding starts to occur, and one
starts to gain traction, where the parts of the code that really matter start to
be modified and manipulated in a such a way that you can tell that that's where
much of the solution lies.
Stage Three is where you're probably on the edge of giving up, and just make the
decision to spend another 1-2h just trying to push ahead. Weird things happen.
It seems like code gets edited and restored in an unproductive circle, yet
somehow something happens that nudges it forward. Then some key debugging
output coupled with new tests and sections of code finally lead you down the
path to success.
Stage Three is where it ALL happens. DO IT.
- BE
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |