> I fixed the issues I mentioned and the snippet now works as intended. Just
> compile and run rtexample to check it out.
> I'll continue with the next snipped I proposed unless you think I should do
> something else instead :P
I think you’re right on track. Your stubs in the code ( *_FACTOR and
MAT_DENSITY) naturally lend themselves to substitution with a function, and
implementing those functions figuring that out from your density_point
structure next would be a good progression. I’d suggest starting with 0
points, 1 point, 2 points, etc.
Note that currently, what is stored on disk is a material ID number (an
integer). There’s a mapping of integers to floating point density values and
text string descriptions (example at http://brlcad.org/~sean/dotdensity
<http://brlcad.org/~sean/dotdensity> ) which is what rtweight uses. The gqa
tool has the user import the text file into the .g file, but it’s still
basically a map<int, pair<double, string> >.
Probably a good time to revisit the big picture now that there’s more
familiarity with terminology:
http://brlcad.org/wiki/Density_functions
<http://brlcad.org/wiki/Density_functions>
http://brlcad.org/wiki/Material_and_Shader_Objects
<http://brlcad.org/wiki/Material_and_Shader_Objects>
> Which TODO do you mean?
The one in the source top-level.
> I'd like to make a little function that, having only axis vectors (since it's
> what we agreed to start off with), returns density values at any given point.
> We can then call this function from rtweight and see if simple examples like
> the box actually return the expected results.
For 0 and 1 points, there are no vectors. When you get to 2 points, you can
just create a vector from one to the other (and your function can simply
calculate it’s distance to each to know where it is in the gradient).
Cheers!
Sean
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel