public function inputKBT($x1, $y1, $z1, $x2, $y2, $z2, $alfa2, $beta2, $lp) { $SLP = $lp * sin($alfa2); $XHP = $x2 - $SLP * sin($beta2); $YHP = $y2 - $SLP * cos($beta2); $ZHP = $z2 - $lp * cos($alfa2); $X1prim = 0; $Y1prim = 0; $XHPprim = ($XHP - $x1) * cos($beta2) - ($YHP - $y1) * sin($beta2); $YHPprim = ($XHP - $x1) * sin($beta2) + ($YHP - $y1) * cos($beta2); $X2prim = ($x2 - $x1) * cos($beta2) - ($y2 - $y1) * sin($beta2); $Y2prim = ($x2 - $x1) * sin($beta2) + ($y2 - $y1) * cos($beta2); $IKS = $XHPprim; $IGREK = $YHPprim; $R = ABS(($IKS * $IKS + $IGREK * $IGREK) / 2 / $IKS); $delta0 = arcsin(abs($IGREK / $R)); if ($IKS > 0) { $wsk = 1; $a = $IKS - $R; $b = $IGREK; if ($a >= 0 && $b >= 0) { $delta = pi() - $delta0; } if ($a >= 0 && $b < 0) { $delta = pi() + $delta0; } if ($a < 0 && $b >= 0) { $delta = $delta0; } if ($a < 0 && $b < 0) { $delta = 2 * pi() - $delta0; } } elseif ($IKS <= 0) { $wsk = -1; $a = $IKS + $R; $b = $IGREK; if ($a >= 0 && $b >= 0) { $delta = $delta0; } if ($a >= 0 && $b < 0) { $delta = 2 * pi() - $delta0; } if ($a < 0 && $b >= 0) { $delta = pi() - $delta0; } if ($a < 0 && $b < 0) { $delta = pi() + $delta0; } } $res['wskH'] = $wsk; $res['RH'] = $R; $res['deltaH'] = $delta; $res['SLK'] = $RH * $deltaH; $res['SLC'] = $SLK + $Slp; $S1 = 0; $S2 = $SLC; $S1prim = 0; $Z1prim = 0; $SHPprim = $SLK * cos($alfa2) - ($Z2 - $lp * cos($alfa2) - $Z1) * sin($alfa2); $ZHPprim = $SLK * sin($alfa2) + ($Z2 - $lp * cos($alfa2) - $Z1) * cos($alfa2); $S2prim = ($S2 - $S1) * cos($alfa2) - ($Z2 - $Z1) * sin($alfa2); $Z2prim = ($S2 - $S1) * sin($alfa2) + ($Z2 - $Z1) * cos($alfa2); $IKS = $SHPprim; $IGREK = $ZHPprim; $R = ABS(($IKS * $IKS + $IGREK * $IGREK) / 2 / $IKS); $delta0 = arcsin(abs($IGREK / $R)); if ($IKS > 0) { $wsk = 1; $a = $IKS - $R; $b = $IGREK; if ($a >= 0 && $b >= 0) { $delta = pi() - $delta0; } if ($a >= 0 && $b < 0) { $delta = pi() + $delta0; } if ($a < 0 && $b >= 0) { $delta = $delta0; } if ($a < 0 && $b < 0) { $delta = 2 * pi() - $delta0; } } elseif ($IKS <= 0) { $wsk = -1; $a = $IKS + $R; $b = $IGREK; if ($a >= 0 && $b >= 0) { $delta = $delta0; } if ($a >= 0 && $b < 0) { $delta = 2 * pi() - $delta0; } if ($a < 0 && $b >= 0) { $delta = pi() - $delta0; } if ($a < 0 && $b < 0) { $delta = pi() + $delta0; } } $res['wskV'] = $wsk; $res['RV'] = $R; $res['deltaV'] = $delta; $res['LK'] = $RV * $deltaV; $res['LC'] = $LK * $lp; return $res; }
function tri_rect_angle($r) { //adj/opp/hyp //renvoie angle en degrès if (!$r[0]) { return arcsin(sin_rect($r[1], $r[2])); } if (!$r[1]) { return arccos(cos_rect($r[0], $r[2])); } if (!$r[2]) { return arctan(tan_rect($r[1], $r[0])); } }