Quantcast

Jump to content

» «
Photo

[REQ] Occlusion Tool

6 replies to this topic
spaceeinstein
  • spaceeinstein

    巧克力

  • Members
  • Joined: 17 Jul 2003
  • None

#1

Posted 01 May 2005 - 10:28 PM

I have been doing occlusions for a few months now. I have to find coordinates and calculate those to create an occlusion for Vice City. It was incredibly boring when I want to mass produce these things. I want a calculator that helps makes my life easier.

First I give you these coordinates:
X1 - -104.6
Y1 - -1256.1
X2 - -76.8
Y2 - -1221

Which will be created into this:
-90.7, -1238.55, -40.0, 27.8, 35.1, 218.4, 0.0

For the first number, find the average of X1 and X2.
Xavg - -90.7

For the second number, find the average of Y1 and Y2.
Yavg - -1238.55

Leave the third number alone.
-40.0

For the fourth number, find the difference of X1 and X2:
Xrang - 27.8

Fifth number, difference of Y1 and Y2:
Yrang - 35.1

Leave the rest alone.

Now, is it possible to make a program that can do all that?

Opius
  • Opius

    General

  • Feroci Racing
  • Joined: 27 Jun 2002

#2

Posted 01 May 2005 - 11:29 PM

Working on a simple PHP script now. Gotta leave, so it might be around six hours or so.

Mike
  • Mike

    Hustler

  • The Connection
  • Joined: 31 Mar 2002

#3

Posted 02 May 2005 - 12:25 AM

Well.. i was kinda bored and i'm on my laptop. So i made one in mIRC script tounge.gif

/occlu to get it started wink.gif

user posted image

CODE
alias occlu {
 if ($dialog(occlu)) { dialog -v occlu }
 else { dialog -md occlu occlu }
}
dialog occlu {
 title "Occlusion calculator"
 size 200 200 400 100

 text "X1", 1, 10 10 11 20
 edit "", 2, 23 10 60 20

 text "X2", 3, 90 10 11 20
 edit "", 4, 103 10 60 20

 text "Y1", 5, 160 10 11 20
 edit "", 6, 173 10 60 20

 text "Y2", 7, 230 10 11 20
 edit "", 8, 243 10 60 20

 text "Output:", 9, 10 40 40 20
 edit "", 10, 52 40 200 20

 button "Process", 11, 310 10 50 20
}
on *:dialog:occlu:sclick:11:{
 var %xavg = $calc(($did(occlu,2) + $did(occlu,4)) / 2)
 var %yavg = $calc(($did(occlu,6) + $did(occlu,8)) / 2)
 if ($did(occlu,2) > $did(occlu,4)) { var %xrang = $calc($did(occlu,2) - $did(occlu,4)) }
 else { var %xrang = $calc($did(occlu,4) - $did(occlu,2)) }
 if ($did(occlu,6) > $did(occlu,8)) { var %xrang = $calc($did(occlu,6) - $did(occlu,8)) }
 else { var %xrang = $calc($did(occlu,8) - $did(occlu,6)) }
 did -o occlu 10 1 %xavg %yavg -40.0 %xrang %yrang 218.4 0.0
}


-Mike

spaceeinstein
  • spaceeinstein

    巧克力

  • Members
  • Joined: 17 Jul 2003
  • None

#4

Posted 02 May 2005 - 02:15 AM

Oh cool. Can you upload it? I don't know anything about programming.

Opius
  • Opius

    General

  • Feroci Racing
  • Joined: 27 Jun 2002

#5

Posted 02 May 2005 - 04:47 AM

CODE
<HTML><HEAD><TITLE>Opius's Cull.IPL Line Generator</TITLE></HEAD>
<BODY>
<p><FORM ACTION="space.php" METHOD="POST">
<input type="hidden" name="do" value="cal">
X1:<INPUT NAME="x1" TYPE="text" size="8">
Y1:<INPUT NAME="y1" TYPE="text" size="8">
Z1:<INPUT NAME="z1" TYPE="text" size="8">
X2:<INPUT NAME="x2" TYPE="text" size="8">
Y2:<INPUT NAME="y2" TYPE="text" size="8">
Z2:<INPUT NAME="z2" TYPE="text" size="8">
<INPUT TYPE="submit" NAME="sub">
</form></p>
<?
$do = $_POST['do'];
$x1 = $_POST['x1'];
$y1 = $_POST['y1'];
$z1 = $_POST['z1'];
$x2 = $_POST['x2'];
$y2 = $_POST['y2'];
$z2 = $_POST['z2'];
//if data posted, AND data is numeric, do the magic
if ($do == "cal" && is_numeric($x1) && is_numeric($y1) && is_numeric($z1) && is_numeric($x1) && is_numeric($y2) && is_numeric($z2))
{
//find average of x1 and x2
$p1 = (($x1 + $x2) /2);

//find average of y1 and y2
$p2 = (($y1 + $y2) /2);

//z part
$p3 = $z1;

//find range of x1 and x2
$p4 = ($x2 - $x1);

//find range of y1 and y2
$p5 = ($y2 - $y1);

//z part
$p6 = $z2;

//print to page
echo '<p>'. $p1 .', '. $p2 .', '. $p3 .', '. $p4 .', '. $p5 .', '. $p6 .'</p>';
}
else
{
echo '<p>No data posted or data not numeric</p>';
}
?>
</BODY>
</HTML>

I can have one uploaded and ready to run in about three hours. If you have a server running PHP, simply dump that code into an empty file, save it on the server, then visit the page.

Opius
  • Opius

    General

  • Feroci Racing
  • Joined: 27 Jun 2002

#6

Posted 02 May 2005 - 07:27 AM

And here is your no-bullsh*t executable version.

spaceeinstein
  • spaceeinstein

    巧克力

  • Members
  • Joined: 17 Jul 2003
  • None

#7

Posted 02 May 2005 - 06:39 PM

Wow, thanks a lot. I can't believe I wasted a lot of time doing calculations via Calculator.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users