|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
So.. What do I mean by that? Well, I have a little bot I made that,
currently, is fairly stupid about how it flies around. It occurred to me
that I could improve it using a spline path, but then I also considered
that this has a limitation, since I am using a "through the points"
version, which doesn't allow you to "fine tune" the curve.
So, instead I am looking at this, an interpolated B-Spline:
n = llGetListLength(P);
// Create B, A and D list of same length as P here.
B[1] = -0.25;
A[1] = (P[2] - P[0] - D[0]) / 4;
for (i = 2; i < n - 1; i++){
B[i] = -1 / (4 + B[i - 1]);
A[i] = P[i + 1] - P[i - 1] - A[i - 1]) * B[i];}
for (i = N - 2; i > 0; i--){
D[i] = A[i] + D[i + 1] * B[i];}
// Figure out our ends, so things start and end where they are
// supposed to.
D[0] = (P[1] - P[0])/3;
D[n] = (P[n] - P[n - 1])/3;
So.. This has more elements, so *may* allow someone to play more with
the results, and produce a curve that gets "sloppy".
I just have two problems... The first one is that the A part has to be
pre-computed for the path, so you can't "recompute" the thing on the
fly. Catmull-rom had the advantage that, you could change the next point
"on the fly", since it only computed between three points, and the
computations didn't require, as above, that you first compute where your
control points needed to be *then* computer the path *from* those. I.e.,
P is where you would like to be, A is the B-spline control points, and D
is the actual path. Means, if I use this, I have to recompute any
changes I make, as the bot moves between the computed points, which
wastes more script time.
Now, Catmull I could tweak the curve, to some extent, by either adding a
multiplier, i.e., adjusting the curve slightly over/under its normal
size, but that just grows/shrinks the path, without changing the path.
Picking some other random point, and using that for the next target, in
the path, is also something vaguely possible, but I don't want this
thing wandering through a wall, because the curve segment plotted sends
it through one, and unless I pick "middle of the room" for every path
point, I can't be sure that any point I pick won't be outside the room.
Basically, when this thing takes damage, I want it to start pathing
erratically. Instead of following nice smooth paths between rooms, I
want it to go a bit off-path, worse as it gets more and more damaged.
And, while I would have preferred Catmull, due to the much simpler, and
stepwise friendly, math it uses (the interpolated one is *not even
close* in that regard), I figured maybe mucking with B in the above
might produce the effect I wanted.
Any suggestions?
Mind, I can detect walls, by running into them, so, it just occurred to
me that I could pick a random point within some value of the third one
in the current path, then just "bump" the wall, and recompute with the
next "correct" point, or the like. Need to experiment with that a bit..
Still.. Would be nice to have a clear idea what I am going to end up
with first. I am not even sure, since the system doesn't have any
indirect (I.e., not running into them first) way of finding walls yet,
how to work out where such a bot should be "allowed" to fly, never mind
mess with the path after. Closest I can manage now is to prefigure where
all the points are it needs to know about, then compute "between" those
preset points. Which is just annoying, since I have to then do that (or
if I sell a version, provide someone else with a way to do so), for
every single place I might want to put the thing in. It also presents
problems for another design I wanted to do, which I might want to have
coded to "Look for tight places, corners, the edge of walls, and keep
away from people, but still close enough to see them." That's going to
have to wait for them to implement the ray cast test, which will allow
mapping of a space, though.
--
void main () {
if version = "Vista" {
call slow_by_half();
call DRM_everything();
}
call functional_code();
}
else
call crash_windows();
}
<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models,
3D Content, and 3D Software at DAZ3D!</A>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 04/12/2010 20:08, Patrick Elliott nous fit lire :
>
> Any suggestions?
>
Change your spline, get a x spline (basic, general or extended) or a tcb
spline and adjust some parameter with the damage level.
Post a reply to this message
Attachments:
Download 'splines_ref.png' (72 KB)
Preview of image 'splines_ref.png'
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 12/4/2010 12:22 PM, Le_Forgeron wrote:
> Le 04/12/2010 20:08, Patrick Elliott nous fit lire :
>
>>
>> Any suggestions?
>>
> Change your spline, get a x spline (basic, general or extended) or a tcb
> spline and adjust some parameter with the damage level.
Hmm. Tcb and General X Spline do both look real interesting. Now to hunt
down formula on them I can bloody understand. lol
--
void main () {
If Schrödingers_cat is alive or version > 98 {
if version = "Vista" {
call slow_by_half();
call DRM_everything();
}
call functional_code();
}
else
call crash_windows();
}
<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models,
3D Content, and 3D Software at DAZ3D!</A>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 12/4/2010 7:50 PM, Patrick Elliott wrote:
> On 12/4/2010 12:22 PM, Le_Forgeron wrote:
>> Le 04/12/2010 20:08, Patrick Elliott nous fit lire :
>>
>>>
>>> Any suggestions?
>>>
>> Change your spline, get a x spline (basic, general or extended) or a tcb
>> spline and adjust some parameter with the damage level.
>
> Hmm. Tcb and General X Spline do both look real interesting. Now to hunt
> down formula on them I can bloody understand. lol
And.. May need help with that. Formula I am using for Catmull is:
P0 = llList2Vector(points,0);
P1 = llList2Vector(points,1);
P2 = llList2Vector(points,2);
P3 = llList2Vector(points,3);
for (t = 0; t < 1; t = t + 0.1)
NP = 0.5 * ((2 * P1) + (P2 - P0) * t + (2 * P0 - 5 * P1 + 4 * P2 -
P3) * t * t - (3 * P1 - P0 - 3 * P2 + P3) * t * t * t;
Which I assume is derived from the mess on the bottom of the wiki page
for them.
CINTx(p_{-1}, p_0, p_1, p_2) = 1/2 * x ((2-x) x-1) * p_{-1}
x^2 (3x-5)+2 p_{0}
x ((4-3x) x+1) p_1
(x-1) x^2 p_2
But, truth told, I don't know how to hell they got from one to the
other. It only gets worse with Tcb. It looks like the 'D' interpolation
stuff is going on from the one I was looking at, but I am not sure..
Worse, the code example given is a mish mash of *multiple* curve types,
so its fuzzy as to what belongs to what, and why, and what is being done
in there too.
Sigh. Some days it seems like I need to go back and take/retake about 6
years of math. lol
--
void main () {
If Schrödingers_cat is alive or version > 98 {
if version = "Vista" {
call slow_by_half();
call DRM_everything();
}
call functional_code();
}
else
call crash_windows();
}
<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models,
3D Content, and 3D Software at DAZ3D!</A>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 05/12/2010 04:12, Patrick Elliott nous fit lire :
> On 12/4/2010 7:50 PM, Patrick Elliott wrote:
>> On 12/4/2010 12:22 PM, Le_Forgeron wrote:
>>> Le 04/12/2010 20:08, Patrick Elliott nous fit lire :
>>>
>>>>
>>>> Any suggestions?
>>>>
>>> Change your spline, get a x spline (basic, general or extended) or a tcb
>>> spline and adjust some parameter with the damage level.
>>
>> Hmm. Tcb and General X Spline do both look real interesting. Now to hunt
>> down formula on them I can bloody understand. lol
> It only gets worse with Tcb. It looks like the 'D' interpolation
> stuff is going on from the one I was looking at, but I am not sure..
> Worse, the code example given is a mish mash of *multiple* curve types,
> so its fuzzy as to what belongs to what, and why, and what is being done
> in there too.
>
> Sigh. Some days it seems like I need to go back and take/retake about 6
> years of math. lol
>
You might get some code in the sources of megapov. (have a look at
sources/patches/patches.h )
Attached is a document about x splines.
Post a reply to this message
Attachments:
Download 'xsplines.10.1.1.44.5770.pdf' (283 KB)
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 12/5/2010 2:35 AM, Le_Forgeron wrote:
> Le 05/12/2010 04:12, Patrick Elliott nous fit lire :
>> On 12/4/2010 7:50 PM, Patrick Elliott wrote:
>>> On 12/4/2010 12:22 PM, Le_Forgeron wrote:
>>>> Le 04/12/2010 20:08, Patrick Elliott nous fit lire :
>>>>
>>>>>
>>>>> Any suggestions?
>>>>>
>>>> Change your spline, get a x spline (basic, general or extended) or a tcb
>>>> spline and adjust some parameter with the damage level.
>>>
>>> Hmm. Tcb and General X Spline do both look real interesting. Now to hunt
>>> down formula on them I can bloody understand. lol
>
>> It only gets worse with Tcb. It looks like the 'D' interpolation
>> stuff is going on from the one I was looking at, but I am not sure..
>> Worse, the code example given is a mish mash of *multiple* curve types,
>> so its fuzzy as to what belongs to what, and why, and what is being done
>> in there too.
>>
>> Sigh. Some days it seems like I need to go back and take/retake about 6
>> years of math. lol
>>
>
> You might get some code in the sources of megapov. (have a look at
> sources/patches/patches.h )
>
> Attached is a document about x splines.
Think I might have found something that will work. Just need to run
things the same as I did in my code, which only handles 4 points at a
time, so I could, in principle, change points as needed, like if the
thing got called some place else, while wandering.
But, this is what annoys the hell out of me with technical papers. They
give what I think may be the final equation for the first two classes of
xsplines, then, when you get to the final step, the end all be all of
xsplines, they go, "And, if you have been following along (not a
chance...), these intermediate formulas (oh, hell...), can be applied to
derive the final result (how, you bloody egghead?)." Anyway, at least I
know what I am looking for now, so should be able to find "something". lol
--
void main () {
If Schrödingers_cat is alive or version > 98 {
if version = "Vista" {
call slow_by_half();
call DRM_everything();
}
call functional_code();
}
else
call crash_windows();
}
<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models,
3D Content, and 3D Software at DAZ3D!</A>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|