Our part "particle" primitive is a misnomer (that we need to rename).  It 
should be called a "pill" primitive as it's a lozenge shape with a cylinder 
capped by two hemispheres.  The volume would be:  vol_small_cap/2 + 
vol_big_cap/2 + vol_cyl

For the case where the ends are equal size, that'd be something like ( 4/3 * PI 
* r^3 / 2 ) + ( 4/3 * PI * r^3 / 2 ) + (PI * r^2 * h) which reduces to (4/3 * 
PI * r^3) + (PI *r^2 * h) 

At a glance, it looks like you're calculating something close, but different -- 
at least for volume?

Cheers!
Sean


On Jul 6, 2012, at 12:25 AM, crdueck wrote:

> Hi Wu,
> 
> could you clarify that please? this link 
> (http://brlcad.org/wiki/BRL-CAD_Primitives#part) states that a particle is 
> defined by either a circular frustum or a circular cylinder with two 
> hemispheres on each end.
> 
> On 07/06/2012 12:15 AM, phoenix wrote:
>> Hi,
>> I doubt whether the part primitive is defined in that way. If you raytrace 
>> it, you will find it slightly different from what you see from the draw 
>> command.
>> 
>> Cheers!
>> Wu
>> 
>> ------------------ Original ------------------
>> From:  "crdueck"<crdu...@users.sourceforge.net>;
>> Date:  Fri, Jul 6, 2012 08:09 AM
>> To:  "brlcad-commits"<brlcad-comm...@lists.sourceforge.net>;
>> Subject:  [brlcad-commits] SF.net SVN: 
>> brlcad:[51436]brlcad/trunk/src/librt/primitives/part/part.c
>> 
>> Revision: 51436
>>           http://brlcad.svn.sourceforge.net/brlcad/?rev=51436&view=rev
>> Author:   crdueck
>> Date:     2012-07-06 00:09:14 +0000 (Fri, 06 Jul 2012)
>> Log Message:
>> -----------
>> added rt_part_volume() and rt_part_surf_area()
>> 
>> Modified Paths:
>> --------------
>>     brlcad/trunk/src/librt/primitives/part/part.c
>> 
>> Modified: brlcad/trunk/src/librt/primitives/part/part.c
>> ===================================================================
>> --- brlcad/trunk/src/librt/primitives/part/part.c 2012-07-05 22:35:00 UTC 
>> (rev 51435)
>> +++ brlcad/trunk/src/librt/primitives/part/part.c 2012-07-06 00:09:14 UTC 
>> (rev 51436)
>> @@ -1813,6 +1813,56 @@
>>  }
>>  
>>  
>> +/**
>> + * R T _ P A R T _ V O L U M E
>> + */
>> +void
>> +rt_part_volume(fastf_t *vol, const struct rt_db_internal *ip)
>> +{
>> +    fastf_t vrad, hrad, mag_h;
>> +    struct rt_part_internal *pip = (struct rt_part_internal *)ip->idb_ptr;
>> +    RT_PART_CK_MAGIC(pip);
>> +
>> +    vrad = pip->part_vrad;
>> +    hrad = pip->part_hrad;
>> +    mag_h = MAGNITUDE(pip->part_H);
>> +
>> +    if (EQUAL(vrad, hrad)) {
>> +        *vol = M_PI * vrad * vrad * (4.0/3.0 * vrad + mag_h);
>> +    } else {
>> +        fastf_t vrad3, hrad3, mid_section;
>> +        vrad3 = vrad * vrad * vrad;
>> +        hrad3 = hrad * hrad * hrad;
>> +        mid_section = M_PI * mag_h * (hrad * hrad + vrad * vrad + hrad * 
>> vrad) / 3.0;
>> +        *vol = 2.0/3.0 * M_PI * (vrad3 + hrad3) + mid_section;
>> +    }

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to