For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > September 2006 > Mystifying









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Mystifying
Jean Pierre Daviau

2006-09-26, 6:57 pm

Hi gurus,

?????????????
Fatal error: Cannot access empty property in C:\Documents and Settings\Jean
Pierre\Bureau\learnphp\arc.php on line 75

How comes my property dissapear on line
75 array_push($this->data2, $this->rayon($x2, $y2, $this->$pt3a,
$this->$pt3b));

and suddenly
$this->data2
does not load the information?

I putted down the program without numbers in case somebody wants to try it.

----
0 <?php
1
2
3 class arcLength {
4
5 private $pentes = array();
6 private $pteInvDroitAlg = array();
7 private $data2 = array();
8
9 private $pt1a;
10 private $pt1b;
11 private $pt2a;
12 private $pt2b;
13 private $pt3a;
14 private $pt3b;
15
16 public function __construct($argv) {
17 $this->pt1a = $argv[1];
18 $this->pt1b = $argv[2];
19 $this->pt2a = $argv[3];
20 $this->pt2b = $argv[4];
21 $this->pt3a = $argv[5];
22 $this->pt3b = $argv[6];
23 }
24
25
26 function __destruct() {
27 //print "\n\nIn \$arcLength->destruct.";
28 ob_clean();
29 }
30
31 function pentes($a, $b, $a´, $b´) {
32 echo "\n" . $a´ . " - " . $a . "\n";
33 echo $b´ . " - " . $b . "\n";
34 if (($a´ - $a) != 0) {
35 (float)$pte = ($b´ - $b) / ($a´ - $a);
36 array_push($this->pentes, $pte);
37 return $pte;
38 } else {
39 array_push($this->pentes, null);
40 return null;
41 }
42 }
43
44 function longueurdArc($centrex, $centrey, $pta, $ptb, $pta´, $ptb´) {
45 $pnte = $this->pentes[2]; //$this->pentes($pta, $ptb, $pta´, $ptb´);
46 $c = $ptb - ($pta * $pente);
47 $b2 = ($centrey - $c) / $centrex;
48
49 $c´ = $ptb´ - ($pta´ * $pnte);
50 $b2´ = ($centrey - $c´) / $centrex;
51
52 echo '$c ' . $c . ' $centrex ' . $centrex . ' $centrey ' . $centrey .
" \n\$b2 " . rad2deg(atan($b2)) . " \n\$b2´ " . rad2deg(atan($b2´)) . "\n";
53 $perimetre = ($this->data2[14] * 2 * M_PI);
54 $sommeDesAngles = rad2deg(atan($b2)) + rad2deg(atan($b2´));
55 $arc = $perimetre * ($sommeDesAngles / 360);
56 echo "\narc " . $arc . " pouces";
57 }
58
59 function rayon($x2´, $y2´, $m, $n) {
60
61 $rayon = sqrt(pow($m - $x2´, 2) + pow(($n - $y2´), 2));
62 echo "\n\$rayon->" . $rayon;
63 return $rayon;
64 }
65
66 //$y = ((1 / $pente) * $x) + $c;
67 function pointsdIntersection() {
68
69 $x2 = ($this->pteInvDroitAlg[6] - $this->pteInvDroitAlg[10]) /
($this->pteInvDroitAlg[11] - $this->pteInvDroitAlg[7]);
70 echo "\centre \$x " . $x2 . "\n";
71
72 $y2 = (($this->pteInvDroitAlg[11] * $x2) +
$this->pteInvDroitAlg[10]);
73 echo "\centre \$y " . $y2;
74 array_push($this->data2, $x2, $y2);
75 array_push($this->data2, $this->rayon($x2, $y2, $this->$pt3a,
$this->$pt3b));
76 array_push($this->data2, "end");
77
78 }
79
80 function pteInvAlgeb($x, $y, $c, $pente) {
81
82 array_push($this->pteInvDroitAlg, $x, $y, $c, $pente);
83 $y´ = ($pente * $x) + $c; //528.725
84 return $y´;
85 }
86
87 function pteInv($pta, $ptb, $pta´, $ptb´, $pente, $c) {
88
89 $x = ($pta + $pta´) / 2;
90 $y = ($ptb + $ptb´) / 2;
91 $pente2 = (1 / $pente );
92 $c = $y - ($pente2 * $x);
93
94 $y´ = $this->pteInvAlgeb($x, $y, $c, $pente2);
95
96 $texte = "\n\npteInv\n--\n";
97 $texte = $texte . "\$penteIn= " . $pente2 . "\n";
98 $texte = $texte . "\$x= " . $x . "\n";
99 $texte = $texte . "\$y= " . $y . "\n";
100 $texte = $texte . "\$y´= " . $y´ . "\n";
101 $texte = $texte . "\$c= " . $c;
102 echo $texte . "\n--\n\n";
103 }
104
105 function segments($pta, $ptb, $pta´, $ptb´, $pente) {
106
107 $texte = "\n\nsegments--\n";
108
109 (float)$c = $ptb - ($pta * $pente);
110 $texte = $texte . "\$c= " . $c . "\n";
111
112 (float)$y = ($pente * $pta) + $c;
113 $texte = $texte . "\$y= " . $y;
114 echo $texte . "\n--\n\n";
115
116 $this->pteInv($pta, $ptb, $pta´, $ptb´, $pente, $c);
117 }
118
119 function main() {
120 if ($this->pentes($this->pt1a, $this->pt1b, $this->pt2a,
$this->pt2b) != null)
121 $this->segments($this->pt1a, $this->pt1b, $this->pt2a,
$this->pt2b, $this->pentes[0]);
122 else
123 echo 'null'. "\n";
124
125 if ($this->pentes($this->pt2a, $this->pt2b, $this->pt3a,
$this->pt3b) != null)
126 $this->segments($this->pt2a, $this->pt2b, $this->pt3a,
$this->pt3b, $this->pentes[1]);
127 else
128 echo 'null'. "\n";
129
130 if ($this->pentes($this->pt1a, $this->pt1b, $this->pt3a,
$this->pt3b) != null)
131 $this->segments($this->pt1a, $this->pt1b, $this->pt3a,
$this->pt3b, $this->pentes[2]);
132 else
133 echo 'null'. "\n";
134
135 print 'pentes ';
136 print_r ($this->pentes) . "\n";
137 print 'pteInvDroitAlg ';
138 print_r ($this->pteInvDroitAlg) . "\n";
139 print 'data2 ';
140 print_r ($this->data2) . "\n";
141
142 $this->pointsdIntersection();
143 $this->longueurdArc($this->data2[12], $this->data2[13], $this->pt1a,
$this->pt1b, $this->pt3a, $this->pt3b);
144
145
146 }
147 }
148 $R = new arcLength($argv);
149
150 $R->main();
151 ?>
php -check-f arc.php 1 1 26 16 51 1
php -check-f arc.php 0 14 73.5 9 96 0



======= without numbers =====================

<?php
//require_once("c:\php\misc\error_handle.php");

class arcLength {

private $pentes = array();
private $pteInvDroitAlg = array();
private $data2 = array();

private $pt1a;
private $pt1b;
private $pt2a;
private $pt2b;
private $pt3a;
private $pt3b;

public function __construct($argv) {
$this->pt1a = $argv[1];
$this->pt1b = $argv[2];
$this->pt2a = $argv[3];
$this->pt2b = $argv[4];
$this->pt3a = $argv[5];
$this->pt3b = $argv[6];
}


function __destruct() {
//print "\n\nIn \$arcLength->destruct.";
ob_clean();
}

function pentes($a, $b, $a´, $b´) {
echo "\n" . $a´ . " - " . $a . "\n";
echo $b´ . " - " . $b . "\n";
if (($a´ - $a) != 0) {
(float)$pte = ($b´ - $b) / ($a´ - $a);
array_push($this->pentes, $pte);
return $pte;
} else {
array_push($this->pentes, null);
return null;
}
}

function longueurdArc($centrex, $centrey, $pta, $ptb, $pta´, $ptb´) {
$pnte = $this->pentes[2]; //$this->pentes($pta, $ptb, $pta´, $ptb´);
$c = $ptb - ($pta * $pente);
$b2 = ($centrey - $c) / $centrex;

$c´ = $ptb´ - ($pta´ * $pnte);
$b2´ = ($centrey - $c´) / $centrex;

echo '$c ' . $c . ' $centrex ' . $centrex . ' $centrey ' . $centrey . "
\n\$b2 " . rad2deg(atan($b2)) . " \n\$b2´ " . rad2deg(atan($b2´)) . "\n";
$perimetre = ($this->data2[14] * 2 * M_PI);
$sommeDesAngles = rad2deg(atan($b2)) + rad2deg(atan($b2´));
$arc = $perimetre * ($sommeDesAngles / 360);
echo "\narc " . $arc . " pouces";
}

function rayon($x2´, $y2´, $m, $n) {

$rayon = sqrt(pow($m - $x2´, 2) + pow(($n - $y2´), 2));
echo "\n\$rayon->" . $rayon;
return $rayon;
}

//$y = ((1 / $pente) * $x) + $c;
function pointsdIntersection() {

$x2 = ($this->pteInvDroitAlg[6] - $this->pteInvDroitAlg[10]) /
($this->pteInvDroitAlg[11] - $this->pteInvDroitAlg[7]);
echo "\centre \$x " . $x2 . "\n";

$y2 = (($this->pteInvDroitAlg[11] * $x2) + $this->pteInvDroitAlg[10]);
echo "\centre \$y " . $y2;
array_push($this->data2, $x2, $y2);
array_push($this->data2, $this->rayon($x2, $y2, $this->$pt3a,
$this->$pt3b));
array_push($this->data2, "end");

}

function pteInvAlgeb($x, $y, $c, $pente) {

array_push($this->pteInvDroitAlg, $x, $y, $c, $pente);
$y´ = ($pente * $x) + $c; //528.725
return $y´;
}

function pteInv($pta, $ptb, $pta´, $ptb´, $pente, $c) {

$x = ($pta + $pta´) / 2;
$y = ($ptb + $ptb´) / 2;
$pente2 = (1 / $pente );
$c = $y - ($pente2 * $x);

$y´ = $this->pteInvAlgeb($x, $y, $c, $pente2);

$texte = "\n\npteInv\n--\n";
$texte = $texte . "\$penteIn= " . $pente2 . "\n";
$texte = $texte . "\$x= " . $x . "\n";
$texte = $texte . "\$y= " . $y . "\n";
$texte = $texte . "\$y´= " . $y´ . "\n";
$texte = $texte . "\$c= " . $c;
echo $texte . "\n--\n\n";
}

function segments($pta, $ptb, $pta´, $ptb´, $pente) {

$texte = "\n\nsegments--\n";

(float)$c = $ptb - ($pta * $pente);
$texte = $texte . "\$c= " . $c . "\n";

(float)$y = ($pente * $pta) + $c;
$texte = $texte . "\$y= " . $y;
echo $texte . "\n--\n\n";

$this->pteInv($pta, $ptb, $pta´, $ptb´, $pente, $c);
}

function main() {
if ($this->pentes($this->pt1a, $this->pt1b, $this->pt2a, $this->pt2b) !=
null)
$this->segments($this->pt1a, $this->pt1b, $this->pt2a, $this->pt2b,
$this->pentes[0]);
else
echo 'null'. "\n";

if ($this->pentes($this->pt2a, $this->pt2b, $this->pt3a, $this->pt3b) !=
null)
$this->segments($this->pt2a, $this->pt2b, $this->pt3a, $this->pt3b,
$this->pentes[1]);
else
echo 'null'. "\n";

if ($this->pentes($this->pt1a, $this->pt1b, $this->pt3a, $this->pt3b) !=
null)
$this->segments($this->pt1a, $this->pt1b, $this->pt3a, $this->pt3b,
$this->pentes[2]);
else
echo 'null'. "\n";

print 'pentes ';
print_r ($this->pentes) . "\n";
print 'pteInvDroitAlg ';
print_r ($this->pteInvDroitAlg) . "\n";
print 'data2 ';
print_r ($this->data2) . "\n";

$this->pointsdIntersection();
$this->longueurdArc($this->data2[12], $this->data2[13], $this->pt1a,
$this->pt1b, $this->pt3a, $this->pt3b);


}
}
$R = new arcLength($argv);
$R->main();

//| php -check-f arc.php 1 1 26 16 51 1
// php -check-f arc.php 0 14 73.5 9 96 0
?>


========================
Thanks for your attention.

Jean Pierre Daviau
--
Easyphp1.8 with Apache1.3.24
Server version: Apache/2.0.55
Server built: Oct 9 2005 19:16:56
DEVC++, borland 5.5
windows Xp
asus p4 s533/333/133
Intel(R) Celeron (R) CPU 2.00 GHz
Processor Radeon7000 0x5159 agp
http://www.jeanpierredaviau.com


ZeldorBlat

2006-09-26, 6:57 pm


Jean Pierre Daviau wrote:
> Hi gurus,
>
> ?????????????
> Fatal error: Cannot access empty property in C:\Documents and Settings\Je=

an
> Pierre\Bureau\learnphp\arc.php on line 75
>
> How comes my property dissapear on line
> 75 array_push($this->data2, $this->rayon($x2, $y2, $this->$pt3a,
> $this->$pt3b));
>
> and suddenly
> $this->data2
> does not load the information?
>
> I putted down the program without numbers in case somebody wants to try i=

t=2E
>
> ----
> 0 <?php
> 1
> 2
> 3 class arcLength {
> 4
> 5 private $pentes =3D array();
> 6 private $pteInvDroitAlg =3D array();
> 7 private $data2 =3D array();
> 8
> 9 private $pt1a;
> 10 private $pt1b;
> 11 private $pt2a;
> 12 private $pt2b;
> 13 private $pt3a;
> 14 private $pt3b;
> 15
> 16 public function __construct($argv) {
> 17 $this->pt1a =3D $argv[1];
> 18 $this->pt1b =3D $argv[2];
> 19 $this->pt2a =3D $argv[3];
> 20 $this->pt2b =3D $argv[4];
> 21 $this->pt3a =3D $argv[5];
> 22 $this->pt3b =3D $argv[6];
> 23 }
> 24
> 25
> 26 function __destruct() {
> 27 //print "\n\nIn \$arcLength->destruct.";
> 28 ob_clean();
> 29 }
> 30
> 31 function pentes($a, $b, $a=B4, $b=B4) {
> 32 echo "\n" . $a=B4 . " - " . $a . "\n";
> 33 echo $b=B4 . " - " . $b . "\n";
> 34 if (($a=B4 - $a) !=3D 0) {
> 35 (float)$pte =3D ($b=B4 - $b) / ($a=B4 - $a);
> 36 array_push($this->pentes, $pte);
> 37 return $pte;
> 38 } else {
> 39 array_push($this->pentes, null);
> 40 return null;
> 41 }
> 42 }
> 43
> 44 function longueurdArc($centrex, $centrey, $pta, $ptb, $pta=B4, $ptb=

=B4) {
> 45 $pnte =3D $this->pentes[2]; //$this->pentes($pta, $ptb, $pta=B4, =

$ptb=B4);
> 46 $c =3D $ptb - ($pta * $pente);
> 47 $b2 =3D ($centrey - $c) / $centrex;
> 48
> 49 $c=B4 =3D $ptb=B4 - ($pta=B4 * $pnte);
> 50 $b2=B4 =3D ($centrey - $c=B4) / $centrex;
> 51
> 52 echo '$c ' . $c . ' $centrex ' . $centrex . ' $centrey ' . $centre=

y .
> " \n\$b2 " . rad2deg(atan($b2)) . " \n\$b2=B4 " . rad2deg(atan($b2=B4)) .=

"\n";
> 53 $perimetre =3D ($this->data2[14] * 2 * M_PI);
> 54 $sommeDesAngles =3D rad2deg(atan($b2)) + rad2deg(atan($b2=B4));
> 55 $arc =3D $perimetre * ($sommeDesAngles / 360);
> 56 echo "\narc " . $arc . " pouces";
> 57 }
> 58
> 59 function rayon($x2=B4, $y2=B4, $m, $n) {
> 60
> 61 $rayon =3D sqrt(pow($m - $x2=B4, 2) + pow(($n - $y2=B4), 2));
> 62 echo "\n\$rayon->" . $rayon;
> 63 return $rayon;
> 64 }
> 65
> 66 //$y =3D ((1 / $pente) * $x) + $c;
> 67 function pointsdIntersection() {
> 68
> 69 $x2 =3D ($this->pteInvDroitAlg[6] - $this->pteInvDroitAlg[10]) /
> ($this->pteInvDroitAlg[11] - $this->pteInvDroitAlg[7]);
> 70 echo "\centre \$x " . $x2 . "\n";
> 71
> 72 $y2 =3D (($this->pteInvDroitAlg[11] * $x2) +
> $this->pteInvDroitAlg[10]);
> 73 echo "\centre \$y " . $y2;
> 74 array_push($this->data2, $x2, $y2);
> 75 array_push($this->data2, $this->rayon($x2, $y2, $this->$pt3a,
> $this->$pt3b));
> 76 array_push($this->data2, "end");
> 77
> 78 }
> 79
> 80 function pteInvAlgeb($x, $y, $c, $pente) {
> 81
> 82 array_push($this->pteInvDroitAlg, $x, $y, $c, $pente);
> 83 $y=B4 =3D ($pente * $x) + $c; //528.725
> 84 return $y=B4;
> 85 }
> 86
> 87 function pteInv($pta, $ptb, $pta=B4, $ptb=B4, $pente, $c) {
> 88
> 89 $x =3D ($pta + $pta=B4) / 2;
> 90 $y =3D ($ptb + $ptb=B4) / 2;
> 91 $pente2 =3D (1 / $pente );
> 92 $c =3D $y - ($pente2 * $x);
> 93
> 94 $y=B4 =3D $this->pteInvAlgeb($x, $y, $c, $pente2);
> 95
> 96 $texte =3D "\n\npteInv\n--\n";
> 97 $texte =3D $texte . "\$penteIn=3D " . $pente2 . "\n";
> 98 $texte =3D $texte . "\$x=3D " . $x . "\n";
> 99 $texte =3D $texte . "\$y=3D " . $y . "\n";
> 100 $texte =3D $texte . "\$y=B4=3D " . $y=B4 . "\n";
> 101 $texte =3D $texte . "\$c=3D " . $c;
> 102 echo $texte . "\n--\n\n";
> 103 }
> 104
> 105 function segments($pta, $ptb, $pta=B4, $ptb=B4, $pente) {
> 106
> 107 $texte =3D "\n\nsegments--\n";
> 108
> 109 (float)$c =3D $ptb - ($pta * $pente);
> 110 $texte =3D $texte . "\$c=3D " . $c . "\n";
> 111
> 112 (float)$y =3D ($pente * $pta) + $c;
> 113 $texte =3D $texte . "\$y=3D " . $y;
> 114 echo $texte . "\n--\n\n";
> 115
> 116 $this->pteInv($pta, $ptb, $pta=B4, $ptb=B4, $pente, $c);
> 117 }
> 118
> 119 function main() {
> 120 if ($this->pentes($this->pt1a, $this->pt1b, $this->pt2a,
> $this->pt2b) !=3D null)
> 121 $this->segments($this->pt1a, $this->pt1b, $this->pt2a,
> $this->pt2b, $this->pentes[0]);
> 122 else
> 123 echo 'null'. "\n";
> 124
> 125 if ($this->pentes($this->pt2a, $this->pt2b, $this->pt3a,
> $this->pt3b) !=3D null)
> 126 $this->segments($this->pt2a, $this->pt2b, $this->pt3a,
> $this->pt3b, $this->pentes[1]);
> 127 else
> 128 echo 'null'. "\n";
> 129
> 130 if ($this->pentes($this->pt1a, $this->pt1b, $this->pt3a,
> $this->pt3b) !=3D null)
> 131 $this->segments($this->pt1a, $this->pt1b, $this->pt3a,
> $this->pt3b, $this->pentes[2]);
> 132 else
> 133 echo 'null'. "\n";
> 134
> 135 print 'pentes ';
> 136 print_r ($this->pentes) . "\n";
> 137 print 'pteInvDroitAlg ';
> 138 print_r ($this->pteInvDroitAlg) . "\n";
> 139 print 'data2 ';
> 140 print_r ($this->data2) . "\n";
> 141
> 142 $this->pointsdIntersection();
> 143 $this->longueurdArc($this->data2[12], $this->data2[13], $this->pt=

1a,
> $this->pt1b, $this->pt3a, $this->pt3b);
> 144
> 145
> 146 }
> 147 }
> 148 $R =3D new arcLength($argv);
> 149
> 150 $R->main();
> 151 ?>
> php -check-f arc.php 1 1 26 16 51 1
> php -check-f arc.php 0 14 73.5 9 96 0
>
>
>
> =3D=3D=3D=3D=3D=3D=3D without numbers =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> <?php
> //require_once("c:\php\misc\error_handle.php");
>
> class arcLength {
>
> private $pentes =3D array();
> private $pteInvDroitAlg =3D array();
> private $data2 =3D array();
>
> private $pt1a;
> private $pt1b;
> private $pt2a;
> private $pt2b;
> private $pt3a;
> private $pt3b;
>
> public function __construct($argv) {
> $this->pt1a =3D $argv[1];
> $this->pt1b =3D $argv[2];
> $this->pt2a =3D $argv[3];
> $this->pt2b =3D $argv[4];
> $this->pt3a =3D $argv[5];
> $this->pt3b =3D $argv[6];
> }
>
>
> function __destruct() {
> //print "\n\nIn \$arcLength->destruct.";
> ob_clean();
> }
>
> function pentes($a, $b, $a=B4, $b=B4) {
> echo "\n" . $a=B4 . " - " . $a . "\n";
> echo $b=B4 . " - " . $b . "\n";
> if (($a=B4 - $a) !=3D 0) {
> (float)$pte =3D ($b=B4 - $b) / ($a=B4 - $a);
> array_push($this->pentes, $pte);
> return $pte;
> } else {
> array_push($this->pentes, null);
> return null;
> }
> }
>
> function longueurdArc($centrex, $centrey, $pta, $ptb, $pta=B4, $ptb=B4)=

{
> $pnte =3D $this->pentes[2]; //$this->pentes($pta, $ptb, $pta=B4, $pt=

b=B4);
> $c =3D $ptb - ($pta * $pente);
> $b2 =3D ($centrey - $c) / $centrex;
>
> $c=B4 =3D $ptb=B4 - ($pta=B4 * $pnte);
> $b2=B4 =3D ($centrey - $c=B4) / $centrex;
>
> echo '$c ' . $c . ' $centrex ' . $centrex . ' $centrey ' . $centrey .=

"
> \n\$b2 " . rad2deg(atan($b2)) . " \n\$b2=B4 " . rad2deg(atan($b2=B4)) . "=

\n";
> $perimetre =3D ($this->data2[14] * 2 * M_PI);
> $sommeDesAngles =3D rad2deg(atan($b2)) + rad2deg(atan($b2=B4));
> $arc =3D $perimetre * ($sommeDesAngles / 360);
> echo "\narc " . $arc . " pouces";
> }
>
> function rayon($x2=B4, $y2=B4, $m, $n) {
>
> $rayon =3D sqrt(pow($m - $x2=B4, 2) + pow(($n - $y2=B4), 2));
> echo "\n\$rayon->" . $rayon;
> return $rayon;
> }
>
> //$y =3D ((1 / $pente) * $x) + $c;
> function pointsdIntersection() {
>
> $x2 =3D ($this->pteInvDroitAlg[6] - $this->pteInvDroitAlg[10]) /
> ($this->pteInvDroitAlg[11] - $this->pteInvDroitAlg[7]);
> echo "\centre \$x " . $x2 . "\n";
>
> $y2 =3D (($this->pteInvDroitAlg[11] * $x2) + $this->pteInvDroitAlg[10=

]);
> echo "\centre \$y " . $y2;
> array_push($this->data2, $x2, $y2);
> array_push($this->data2, $this->rayon($x2, $y2, $this->$pt3a,
> $this->$pt3b));
> array_push($this->data2, "end");
>
> }
>
> function pteInvAlgeb($x, $y, $c, $pente) {
>
> array_push($this->pteInvDroitAlg, $x, $y, $c, $pente);
> $y=B4 =3D ($pente * $x) + $c; //528.725
> return $y=B4;
> }
>
> function pteInv($pta, $ptb, $pta=B4, $ptb=B4, $pente, $c) {
>
> $x =3D ($pta + $pta=B4) / 2;
> $y =3D ($ptb + $ptb=B4) / 2;
> $pente2 =3D (1 / $pente );
> $c =3D $y - ($pente2 * $x);
>
> $y=B4 =3D $this->pteInvAlgeb($x, $y, $c, $pente2);
>
> $texte =3D "\n\npteInv\n--\n";
> $texte =3D $texte . "\$penteIn=3D " . $pente2 . "\n";
> $texte =3D $texte . "\$x=3D " . $x . "\n";
> $texte =3D $texte . "\$y=3D " . $y . "\n";
> $texte =3D $texte . "\$y=B4=3D " . $y=B4 . "\n";
> $texte =3D $texte . "\$c=3D " . $c;
> echo $texte . "\n--\n\n";
> }
>
> function segments($pta, $ptb, $pta=B4, $ptb=B4, $pente) {
>
> $texte =3D "\n\nsegments--\n";
>
> (float)$c =3D $ptb - ($pta * $pente);
> $texte =3D $texte . "\$c=3D " . $c . "\n";
>
> (float)$y =3D ($pente * $pta) + $c;
> $texte =3D $texte . "\$y=3D " . $y;
> echo $texte . "\n--\n\n";
>
> $this->pteInv($pta, $ptb, $pta=B4, $ptb=B4, $pente, $c);
> }
>
> function main() {
> if ($this->pentes($this->pt1a, $this->pt1b, $this->pt2a, $this->pt2b)=

!=3D
> null)
> $this->segments($this->pt1a, $this->pt1b, $this->pt2a, $this->pt2b,
> $this->pentes[0]);
> else
> echo 'null'. "\n";
>
> if ($this->pentes($this->pt2a, $this->pt2b, $this->pt3a, $this->pt3b)=

!=3D
> null)
> $this->segments($this->pt2a, $this->pt2b, $this->pt3a, $this->pt3b,
> $this->pentes[1]);
> else
> echo 'null'. "\n";
>
> if ($this->pentes($this->pt1a, $this->pt1b, $this->pt3a, $this->pt3b)=

!=3D
> null)
> $this->segments($this->pt1a, $this->pt1b, $this->pt3a, $this->pt3b,
> $this->pentes[2]);
> else
> echo 'null'. "\n";
>
> print 'pentes ';
> print_r ($this->pentes) . "\n";
> print 'pteInvDroitAlg ';
> print_r ($this->pteInvDroitAlg) . "\n";
> print 'data2 ';
> print_r ($this->data2) . "\n";
>
> $this->pointsdIntersection();
> $this->longueurdArc($this->data2[12], $this->data2[13], $this->pt1a,
> $this->pt1b, $this->pt3a, $this->pt3b);
>
>
> }
> }
> $R =3D new arcLength($argv);
> $R->main();
>
> //| php -check-f arc.php 1 1 26 16 51 1
> // php -check-f arc.php 0 14 73.5 9 96 0
> ?>
>
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> Thanks for your attention.
>
> Jean Pierre Daviau
> --
> Easyphp1.8 with Apache1.3.24
> Server version: Apache/2.0.55
> Server built: Oct 9 2005 19:16:56
> DEVC++, borland 5.5
> windows Xp
> asus p4 s533/333/133
> Intel(R) Celeron (R) CPU 2.00 GHz
> Processor Radeon7000 0x5159 agp
> http://www.jeanpierredaviau.com


You need to change:

array_push($this->data2, $this->rayon($x2, $y2, $this->$pt3a,
$this->$pt3b));

to this:

array_push($this->data2, $this->rayon($x2, $y2, $this->pt3a,
$this->pt3b));

Also, there's really no reason to use array_push() when the alternative
is more efficient:

array_push($foo, $bar);

is equivalent to:

$foo[] =3D $bar;

without the overhead of a function call.

Jean Pierre Daviau

2006-09-26, 6:57 pm

Thank you so much.

I was really tired to commit such a mistake and yes I will change my arrays
filling method to yours.

JP


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com