View Full Version : increasing radiusPP relative to shape
09-02-2003, 01:29 PM
can someone capable of efficiently writing expressions help me on the following?!
look, i got this shape filled up with particles, the radius of which is randomly assigned by creation expression.
now, i set the max. radiusPP to 1.2 to avoid particles from penetrating through the flow shape, but the overall distribution of size isn't completely satifying in it's current state.
what i want to know is...how can i increase the radius of random particles in relation to their relative position towards the outer shape? :hmm:
i mean, is there a method to query relative coordinates of bubbles and increase their radius based on this information?
i don't know if i made myself clear...i need to resize a few - and only a few - of those bubbles, while still avoiding penetration, so the only objects in question will be those, that keep streaming right in the middle of the flow shape!
any advice will be welcome! :wavey:
Do I understand it well if Iput it this way that you want to scale down (make radiusPP smaller) when a particle comes closer to the surface of the tube?
09-02-2003, 02:04 PM
nope, i want a few particles to get bigger (scaled up) when further away from the surface! but only a few, randomly chosen...:eek:
ClosestPointOnSurface can tell you how far a particle is apart from a surface. You could use an expression that scales the radiusPP in case the particle is at least a given distance from the surface.
Randomising is just a matter of a couple of lines extra in the script.
09-02-2003, 02:31 PM
well, i'm not too firm on writing expressions yet and i never used closestPointOnSurface before.
after creating the node, i connected the 'input surface' to the 'geometry attribute of the tube-shape. but how to go on from there? how can i query positional data and use it in an expression to get what i need? :shrug:
09-02-2003, 04:10 PM
ok, i'm pondering over several solutions, but i need to know some basics first:
1. how to query the amount of particles of a particle.Shape node?
- i mean, there's that counter on the attribute editor, so i guess the information must be accessible via MEL!
2. how to query per particle positions, like to be seen in the component editor?!
09-02-2003, 04:21 PM
first one solved:
particle -q -ct objectShape;
09-02-2003, 04:40 PM
i love answering my own questions:
particle -attribute position -id -q -vv objectShape;
returns the vector value as [float float float].
anyway, any recommendations or tips are still welcome! :)
09-04-2003, 05:44 PM
as you say ,i can calculate every particle position in world space,
but how can i calculate distance from particle to surface,when surface is no flat
Feed particle's position (the XYZ you obtained by: particle -attribute position -id -q -vv objectShape; into the closestPointOnsurface node and what comes out will be the XYZ position of the closest point on the surface.
Only thing left to do is calculate distance between the particle and the closestPointOnSurface.
09-04-2003, 08:46 PM
yep, i guess you will have to set reference points across the whole surface/curve as a basis for the calculation.
then you'll probably have to evaluate every particles' relative position at any moment of time and offset it's radius!
Btw, to compute the distance between 2 points in space you can use the following procedure.
global proc float computeDist(float $point1, float $point2)
float $xDist = ($point2-$point1);
float $yDist = ($point2-$point1);
float $zDist = ($point2-$point1);
float $dist = sqrt(($xDist*$xDist)+($yDist*$yDist)+($zDist*$zDist));
assign the x y z values to the 2 arrays:
call the procedure like: computeDist($point1, $point2);
eh voila: your distance!
01-16-2006, 01:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.