Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-19-2011, 12:49 AM
dabblercody dabblercody is offline
Tech Assistant
dabblercody's Avatar
Join Date: May 2006
Location: Florida
Posts: 22
dabblercody is on a distinguished road
Beiser Curves

I've recently been trying to figure how to correctly implement this into Graal. I've also been trying to improve my math-based scripting. This is a sample script I had to test the outcome of the 4 given points. The solution I get is x1 and x2 = 5.82375. I just need to find out if this is correct? And if it isn't what is the correct way of doing it, and how can I improve onto my knowledge of scripting? In case your wondering how I got the variable t. And yes I spelled Beiser wrong it should be Bezier.

The t parameter (varying from 0 to 1) cuts the P1-P4 segment to intervals, according to the wanted accuracy.
When t = 0 results are t(x1) = P1(x1) and t(x2)= P1(x2)
When t = 1 results are t(x1) = P4(x1) and t(x2)= P4(x2)


PHP Code:
//#CLIENTSIDE
function onPlayerChats()
{
 if (
player.chat == "/curve")
 {
  
Beiser2D();
 }
}

function 
Beiser2D()
{
 
.05;
 
5;  // p1
 
10// p2
 
25// p3
 
40// p4
 
x1 = (t)^* (t)^* (t) * t^t^d;
 
x2 = (t)^* (t)^* (t) * t^t^d;
 
player.chat "Solution is:" SPC x1 SPC "/" SPC x2;

The Formulas are:
PHP Code:
t(x1) = (1-t)3  x P1x 3 x (1-t)2 x t x P2x 3 x (1-tx t2 x P3x t3 x P4x 
t
(x2) = (1-t)3  x P1y 3 x (1-t)2 x t x P2y 3 x (1-tx t2 x P3y t3 x P4y 
__________________
Dabbler

"Our work is the presentation of our capabilities."
- Goethe, Johann Wolfgang Von

Last edited by dabblercody; 01-19-2011 at 01:10 AM..
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:42 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.