chris wrote:As currently implemented, the motion of a particle in particle system must be expressible as a parametric quadratic curve. Is this adequate for your examples?
What do you mean by "quadratic curve" ? Do you mean a simple polynomial of degree 2 ? If yes, this is pretty limited. At least, the jets and volcano I made are quadratic :
The volcano CELXX code I'm using :
Code: Select all
function parabolic_motion(t)
local orbit = {};
orbit.params = t;
orbit.boundingRadius = 2 * t.InitialRadius
local RandomVelocity = t.MinVelocity + (t.MaxVelocity - t.MinVelocity) * math.random();
local Delta = math.rad(t.MinDeclination + (t.MaxDeclination - t.MinDeclination) * math.random());
local Phi = 2 * math.pi * math.random();
local MaxTime = 2.1 * RandomVelocity * math.sin(Delta)/(86400 * t.Gravity);
local RandomDelay = MaxTime * math.random();
function orbit:position(tjd)
local t = tjd - 2451545.0
local Alpha = math.rad(self.params.Longitude);
local Beta = math.rad(self.params.Latitude);
local CyclicTime = (t - RandomDelay) - MaxTime * math.floor((t - RandomDelay) / MaxTime)
local acct = 3732480 * self.params.Gravity * CyclicTime * CyclicTime;
local v0xt = 86.4 * RandomVelocity * math.cos(Delta) * math.cos(Phi) * CyclicTime;
local v0yt = 86.4 * RandomVelocity * math.cos(Delta) * math.sin(Phi) * CyclicTime;
local v0zt = 86.4 * RandomVelocity * math.sin(Delta) * CyclicTime;
local x = (self.params.InitialRadius + v0zt - acct) * math.cos(Beta) * math.cos(Alpha) - v0xt * math.sin(Beta) * math.cos(Alpha) + v0yt * math.sin(Alpha)
local y = (self.params.InitialRadius + v0zt - acct) * math.cos(Beta) * math.sin(Alpha) - v0xt * math.sin(Beta) * math.sin(Alpha) - v0yt * math.cos(Alpha)
local z = (self.params.InitialRadius + v0zt - acct) * math.sin(Beta) + v0xt * math.cos(Beta)
return x, y, z
end
return orbit
end
The jets code (a trivial variation of the previous one) :
Code: Select all
function jet_motion(t)
local orbit = {};
orbit.params = t;
orbit.boundingRadius = 2 * t.InitialRadius
local v0 = 86.4 * (t.MinVelocity + (t.MaxVelocity - t.MinVelocity) * math.random());
local Delta = math.rad(t.MinDeclination + (t.MaxDeclination - t.MinDeclination) * math.random());
local MaxTime = 0.9 * v0 * math.sin(Delta)/(7464960 * t.Deceleration);
local RandomDelay = MaxTime * math.random();
local Phi = 2 * math.pi * math.random();
function orbit:position(tjd)
local t = tjd - 2451545.0
local PeriodicTime = (t - RandomDelay) - MaxTime * math.floor((t - RandomDelay) / MaxTime);
local x = v0 * math.cos(Delta) * math.cos(Phi) * PeriodicTime
local y = v0 * math.cos(Delta) * math.sin(Phi) * PeriodicTime
local z = self.params.Pole * (self.params.InitialRadius + v0 * math.sin(Delta) * PeriodicTime - 3732480 * self.params.Deceleration * PeriodicTime * PeriodicTime)
return x, y, z
end
return orbit
end
The curves in these two examples are just quadratic polynomials of the time variable (actually a periodic version of time, defined using the "floor" function), with several angles and velocity parameters as input :
equs.jpg
Here, [tex]\beta[/tex] and [tex]\alpha[/tex] are respectively the Latitude and Longitude of the source. The initial velocity ([tex]v_{0 x}[/tex], [tex]v_{0 y}[/tex] and [tex]v_{0 z}[/tex]) is a random vector which depend on [tex]v_{0}[/tex] (random modulus [tex]v_0 \in [v_{0 min}, v_{0 max} ][/tex]), the declination (random value [tex]\delta \in [\delta_{min}, \delta_{max}][/tex]) and the azimuth (random variable [tex]\phi \in [0, 2 \pi[[/tex]) :
[tex]v_{0 x} = v_{0} \cos\delta \cos\phi[/tex],
[tex]v_{0 y} = v_{0} \cos\delta \sin\phi[/tex],
[tex]v_{0 z} = v_{0} \sin\delta[/tex].
In the case of time, I made it cyclic, using the "floor" function :
[tex]CyclicTime = \tau(t) = t - t_0 - T floor(\frac{t - t_0}{T})[/tex],
where [tex]t_0 \in [0, T][/tex] is a random delay and [tex]T[/tex] is the period of the whole motion.
If Celestia could render **
few thousands** of particles in real time for a volcano on Io or a pair of black hole jets, say, with a descent frame rate, it would be AWESOME !
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"