(n)certainties – Die Angewandte – Fall 2008

01_getMagneticFieldVector

////////MAGNETIC FIELD DRAW///////////////////////////////////////////////////////
///PROC GET DIRMAGSUM VECTOR
global proc vector getSum (string $test11, string $charges[])
{
$k= 2;
float $dis;
vector $vadd,$vcharg;
global vector $dirMagSum;
global vector $test;

$charge0=$charges[0];
vector $dirMagSum = <<0,0,0>>;

for ($charge0 in $charges)
{
float $chargeLoad= `getAttr ($charge0+”.scaleX”)`;
//distance to charge
$test= `pointPosition $test11`;
$vcharg= `pointPosition $charge0`;
$vadd= $vcharg-$test;
$dis=mag($vadd);

//get force
$dpow= `pow $dis 2`;
$Force=$k*$chargeLoad/$dpow;

//create vector of direction and force
$dirMag= ($vcharg+(-$test))*$Force;
$dirMagSum= $dirMagSum+$dirMag;
}

return $dirMagSum;
return $test;
}
///END

////////////////////////////////////////////////////////////////////////////////

Leave a Comment

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

You must be logged in to post a comment.