Hi again.
I have been trying to track down the reason why some densities are
negative. A few questions I have ended up asking myself:
- Is it possible for MAGNITUDE() to return a negative number? It would make
no sense to me, but I suspect it's happening.
- In my little function intersection I noticed that I am returning a
pointer to a local variable, that could be destroyed in any moment after
the call ends. Instead of that, I want to return a safe variable. How do I
do that in this case?
I don't understand why it doesn't let me return directly the variable
point_t. It's a pointer, because it's an array, right? As it didn't let me
return the point, I decided to return a pointer to the point instead,
however as I mentioned this is not safe, so I have to change it now. Any
explanation on why I can't return the point, and what I should do to make
it safe?
Finally, I think I could need some help regarding the negative values
issue, at least once I'm sure the two points above aren't the cause.
Mario.
On 17 September 2017 at 21:16, Mario Meissner <mr.rash....@gmail.com> wrote:
> After my linux build decided to not compile anymore (and haven't been able
> to fix it since) I switched back to VStudio and I have been able to run
> rtweight with the density file. Attached goes current state of the code for
> both rtexample (to see how segment_density works) and rtweight.
>
> Doesn't work yet, I'm investigating the cause, but I'll detail what's
> happening here. If I put a point with density 3 inside my 1000x1000x1000mm
> box, it sometimes adds 3 to the datapoint, but then sometimes -1 or -2, and
> in the end the accumulation of all the datapoints evaluates as 0. So
> something in my code segment_density code is allowing for negative values
> and it somehow happens to result in a symmetrical set of positive and
> negative values, adding up to 0.
>
> I'll keep working on this tomorrow, but for now it would be nice to hear
> some more feedback overall.
>
> Mario.
>
> On 15 September 2017 at 16:23, Mario Meissner <mr.rash....@gmail.com>
> wrote:
>
>> I'm working on integrating the code into viewweight.
>> As a first step I thought it would be a good idea to not touch the
>> existing code (and let it read from the .density file) and just override
>> the hit() function to call my segment_density instead of taking the file
>> data. However I'm getting segmentation faults whenever I try to run the
>> code. This happened to me before and I managed to solve it by changing the
>> codification of the .density file, however this time I don't seem to be
>> able to fix it.
>>
>> Here is result screencap, and I also attach the modified viewweight and
>> the density file.
>> https://puu.sh/xAmiE/b5fa0dfab8.png
>>
>> Mario.
>>
>> On 8 September 2017 at 21:04, Mario Meissner <mr.rash....@gmail.com>
>> wrote:
>>
>>> Peopleee!
>>>
>>> Here goes today's work. I'm proud to announce the example I modeled a
>>> few days ago now works correctly!!
>>> Code still contains my debug prints and lots of random 'puts' to know
>>> where and why stuff crashes. I feel I will need it in the future so for now
>>> it remains.
>>> I probably should keep looking for flaws by setting up other examples,
>>> and while doing so I should also clean it up a bit since the code grew over
>>> 600 lines now, quite difficult to read and understand.
>>>
>>> Screenshot:
>>> https://puu.sh/xuIXk/9626ce2fb6.png
>>>
>>> Mario.
>>>
>>> On 8 September 2017 at 19:56, Mario Meissner <mr.rash....@gmail.com>
>>> wrote:
>>>
>>>> Hi Daniel!
>>>>
>>>> Thank you a lot for your reply. I was focused on generating the
>>>> bisector to intersect two lines, but intersecting the actual plane is much
>>>> simpler. I made a little function to intersect a plane with a line
>>>> (partially taken from this stackoverflow post
>>>> <https://stackoverflow.com/questions/5666222/3d-line-plane-intersection>,
>>>> so credits to user ideasman42
>>>> <https://stackoverflow.com/users/432509/ideasman42>). I am now
>>>> finishing of the 'patch' to my code that is supposed to now correctly skip
>>>> unnecessary points and create a list with those who's regions we will
>>>> actually cross. Code probably tomorrow.
>>>>
>>>> Mario.
>>>>
>>>> On 8 September 2017 at 09:35, Daniel Roßberg <danielmrossb...@gmail.com
>>>> > wrote:
>>>>
>>>>> Hi Mario,
>>>>>
>>>>> In 3D space, rectangular to a vector you have a plane and the vector
>>>>> is a normal vector of this plane. In this plane are all vectors which are
>>>>> perpendicular to your first vector, i.e. the vectors which products with
>>>>> your first vector are 0. This gives you a first equation with two
>>>>> variables.
>>>>>
>>>>> Next, you want to intersect the plane with a ray. I.e., one vector
>>>>> from your plan has to be a multiple of the ray which gives you another
>>>>> equation.
>>>>>
>>>>> However, there should be examples in the BRL-CAD source code for
>>>>> this. E.g., the ray-trace of the half primitive is very similar to your
>>>>> problem. There, the intersection of a plane, given by a normal vector and
>>>>> a point in it, and a ray, given by a start point and a direction, will be
>>>>> computed.
>>>>>
>>>>> I hope this helps.
>>>>>
>>>>>
>>>>> Regards,
>>>>> Daniel
>>>>>
>>>>>
>>>>>
>>>>> I'm facing a wall. I need to find a perpendicular vector with the
>>>>> condition that it will intersect a third vector.
>>>>> Basically, I have the ray and a vector drawn from my current point to
>>>>> the previous point.
>>>>> I want the perpendicular bisector of that vector to cross my ray, so
>>>>> that I can obtain the intersection between the bisector and the ray.
>>>>>
>>>>> For that I need two things:
>>>>> 1) Obtain the perpendicular vector. in 3D there are infinite options,
>>>>> but only one will cross the ray. How do I get the one I need?
>>>>> 2) Obtain the intersection point.
>>>>>
>>>>> I browsed through vmath.h but I didn't find anything that could help
>>>>> me. Do you know any macro that could be useful here?
>>>>> Otherwise I will need to make some of my own for this! If so, any
>>>>> ideas on how to approach it?
>>>>>
>>>>> Mario.
>>>>>
>>>>>
>>>>> ------------------------------------------------------------
>>>>> ------------------
>>>>> 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
>>>>>
>>>>>
>>>>
>>>
>>
>
------------------------------------------------------------------------------
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