Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#58 Volume calculation of an intersection object

closed
Sean Morrison
Analysis (3)
5
2010-06-03
2010-05-27
Harun
No

Hi,

I am trying to calculate the intersection volume between a arb8 hexahedron and a tgc (yarn). I get the message below when I use analyze for the combination. Is there an easy way to get the volume of this intersecting volume? Another question is if the time prefix I use actually results in accurate timing info. The intersection and volume calculation timing is important since I intend to use BRL-CAD as a geometry kernel to calculate millions of such intersections.

The comb and analyze commands I used are below.

Thanks a lot for your help.
Harun

mged> time "comb ctest8 u yarn + hex"
182 microseconds per iteration
mged> analyze ctest8
ctest8: --
u yarn
+ hex
analyze: unable to process ID_COMBINATION solid

Discussion

  • Sean Morrison
    Sean Morrison
    2010-06-01

    • assigned_to: nobody --> brlcad
    • status: open --> pending
     
  • Sean Morrison
    Sean Morrison
    2010-06-01

    To properly (i.e., accurately and precisely) calculate a boolean volume, you should use the "gqa" command instead of analyze. The gqa tool can take a while to evaluate, but will calculate down to a given level-of-detail that is user-controlled. You can specify a coarse sampling for a user-defined level of precision. That will generally evaluate relatively fast, though it is very much dependent on the complexity of the model and number of CPU cores.

    The analyze command reports metrics only on primitives, not combination objects. So at best, it'd only be useful to quickly calculate the volume of an intersection's bounding box. Making it work for combinations is planned, but requires some heavy math algorithms and conversion routines be implemented first (and even then, it's questionable whether it'd be faster than gqa's method to evaluate via sampling).

     
  • Harun
    Harun
    2010-06-02

    • status: pending --> open
     
  • Harun
    Harun
    2010-06-02

    Thanks a lot for the response. Is there any documentation on gqa?

    Also, can you comment on using time to measure the performance of the operations?
    time "gqa -v -Av -P 1 int.c"
    219622 microseconds per iteration
    is the time reported reliable? This gets me within 1% of the actual volume of the combined volume (simple enough to calculate exactly).

    Finally I am assuming I will be able to do all this through the code since I plan to embed this in our application.

    Thanks a lot!
    Harun

     
  • Sean Morrison
    Sean Morrison
    2010-06-03

    • status: open --> pending
     
  • Sean Morrison
    Sean Morrison
    2010-06-03

    Yes, there is. The tool is in the middle of a name change (which follows a deprecation process), but there is a manual page for that tool with details on how to use it. For example, you really probably don't want to keep the -v option (the verbose reporting can slow it down considerably), the -P option is good for testing but you generally want to let it run multicpu in production use, and you might want to set the -V volume tolerance or -g grid spacing options. The manpage name is either gqa or g_qa and has more details.

    The 'time' command is a Tcl command that uses the system clock to measure elapsed time. "man n time" is the manual page. It should be reliable for measuring the start-to-finish execution time for mged commands unless it's a command that runs in the background (e.g., 'rt').

    You certainly should be able to embed the execution of gqa into an application. You can either invoke gqa via a system/execl call or using our LIBGED library (via the ged_gqa() function).

    What sort of code are you planning on embedding this into? Feel free to share details of your project to me directly or via the brlcad-users mailing list.

    Cheers!
    Sean

     
  • Harun
    Harun
    2010-06-03

    Sean, Thanks for the information. I tried to send you a message through sourceforge to establish direct contact. Hopefully you will get it.
    Harun

     
  • Harun
    Harun
    2010-06-03

    • status: pending --> open
     
  • Sean Morrison
    Sean Morrison
    2010-06-03

    • status: open --> closed