Question:
Date: 04-02-2015 21:48:58
(In Spanish)
Votes: 3 - Answers: 2 - Views: 14 Share on: Google Facebook Twitter LinkedIn Link
Gráfico de Funciones en 3 ejes[Resolved]
Comparto con ustedes un programa para proyectar funciones en 3 ejes realizado en el marco de un proyecto para la UTN:
<?php
//ángulo de proyección en grados parámetro modificable
$angulo = 15;
//proyección de y sobre el eje x , no modificable
$d = cos($angulo / 180 * pi());
//proyección de z sobre el eje x , no modificable
$d1 = sin($angulo / 180 * pi());
//líneas sobre el eje x, modificable
$m = 80;
//líneas sobre el eje y, modificable
$n = 80;
//x1 x mínimo x2 x máximo (intervalo de estudio) modificable
$x1 = -450;
$x2 = 450;
//y1 y mínimo y2 y máximo (intervalo de estudio) modificable
$y1 = -450;
$y2 = 450;
//ev escala vertical modificable
$ev = 4;
//x3 intervalo de líneas sobre el eje x no modificable
$x3 = ($x2 - $x1) / ($m - 1);
//y3 intervalo de líneas sobre el eje y no modificable
$y3 = ($y2 - $y1) / ($n - 1);
//x abcisa, y ordenada, z cota (función ejemplo: seno (x) + seno (y) modificable)
for ($i = 1; $i <= $m; $i++) {
for ($j = 1; $j <= $n; $j++) {
$x = $x1 + $x3 * ($i - 1);
$y = $y1 + $y3 * ($j - 1);
$ym[$i][$j] = $y - $x * $d;
$zm[$i][$j] = (sin($x) + sin($y) - $x * $d1) * $ev;
}
}
?>
<html>
<head>
</head>
<body>
<svg id="id_svg" width="1000" height="1000">
<?php
//trazado de lineas sobre eje x
for ($i = 1; $i <= $m; $i++) {
$k = 0;
for ($j = 2; $j <= $n; $j++) {
$k = $k + 1;
echo '<line id="' . $i . '_' . $j . '" x1="' . $ym[$i][$k] . '" y1="' . $zm[$i][$k] . '" x2="' . $ym[$i][$j] . '" y2="' . $zm[$i][$j] . '" style="stroke:green; stroke-width:1"/>' . "\n";
}
}
//trazado de líneas sobre eje y
for ($j = 1; $j <= $n; $j++) {
$k = 0;
for ($i = 2; $i <= $m; $i++) {
$k = $k + 1;
echo '<line id="' . $k . '_' . $j . '" x1="' . $ym[$k][$j] . '" y1="' . $zm[$k][$j] . '" x2="' . $ym[$i][$j] . '" y2="' . $zm[$i][$j] . '" style="stroke:green; stroke-width:1"/>' . "\n";
}
}
?>
</svg>
</body>
</html>
Votes: 3 - Answers: 2 - Views: 14 Share on: Google Facebook Twitter LinkedIn Link
Answers:
-
Date: 05-02-2015 05:12:26 Muy interesante el mayado que se dibuja, seguramente disparará más de una idea.

Muchas gracias por el aporte.
Saludos, Votes: 1 - Link answer -
Date: 12-02-2015 07:32:07 Interesante, se me esta ocurriendo algo que puedo hacer con eso... mmm Votes: 0 - Link answer
To actively participate in the community first must authenticate, enter the system.Sign In
