Rsensor behaviour

Is there a way of using rsensor so that ray directions it only generates rays in the forward hemisphere?

I am using rsensor as a convenient way to generate rays that are uniformly distributed (in a statistical sense) over a hemisphere as part of a more complex process. I have a used this type of rsensor invocation (no octree given, in this example the view direction is aligned with the z axis):

$ rsensor -vth -h -vp 0 0 0 -vd 0 0 1 -vu 0 1 0 -vh 180 -vv 180 -rd 256 sensor1.dat . > rays.dat

where ‘sensor1.dat’ contains (I interpreted this as a coarse forward hemisphere definition):

degrees 0 90 180 270
0 0.0833333 0.0833333 0.0833333 0.0833333
45 0.0833333 0.0833333 0.0833333 0.0833333
90 0.0833333 0.0833333 0.0833333 0.0833333

The problem I have is that rsensor generates some rays that are in the rear hemisphere (i.e. the ray direction z component zdir < 0. in this example). In this example these can filtered out easily (using rcalc’s “cond” variable or awk) but I need to deal with the general case of an arbitrary view direction and this is quite awkward to handle at run time.

Welcome to the forum, Esteban!

Did you try having a row at 91 degrees with zero sensitivity values? That might take care of it.

-Greg

Greetings Greg

Estaban is a new alias for an old hand (Steve Walker).

I had tried putting the 90 row to zero but that didn’t help. A variation on
your suggestion that is fine for my purposes is:

sensor2.dat:
degrees 0 90 180 270
0 0.0833333 0.0833333 0.0833333 0.0833333
45 0.0833333 0.0833333 0.0833333 0.0833333
89.9999 0.0833333 0.0833333 0.0833333 0.0833333
90 0. 0. 0. 0.

My problem solved, thanks for your help

Oh, hi Steve. I guess I never really know to whom I’m writing!

Glad you were able to work it out from my hint – I hadn’t ever tried it.

-G