PHPで作図
このページの末尾へ
図形のコピー
: 正四面体
ヘルプ
ドット数(幅
高
)形式(
gif
jpg
)
set_scale($scale = 10, $org_x_percent = 50, $org_y_percent = 50); $scr_w = 30; $len = 8; $h = $len * sqrt(3) / 2; $m = $h * 2 / 3; $v = sqrt($h * $h - $m * $m); set_text_size($text_size = 10); draw_text('平面図', - $scr_w / 2, $scr_w / 2, O_POS_UP_LEFT, false); set_text_size($text_size = 12); $ax = - $scr_w / 4; $ay = $scr_w / 4; $bx = $ax - $len / 2; $by = $ay - $h / 3; $cx = $ax + $len / 2; $cy = $by; $dx = $ax; $dy = $ay + $h * 2 / 3; draw_line($ax, $ay, $bx, $by); draw_line($ax, $ay, $cx, $cy); draw_line($ax, $ay, $dx, $dy); allocate_text_color('black'); draw_text('A(H)', $ax, $ay, O_POS_LOW_RIGHT, false); draw_marked_triangle($bx, $by, $cx, $cy, $dx, $dy, $type_a = 0, $type_b = 0, $type_c = 0, $text_a = '', $text_b = '', $text_c = '', $text_ops_a = 'B', $text_ops_b = 'C', $text_ops_c = 'D', $italic = true, $italic_ops = false, $r = 10); draw_arc_mark($tx, $ty, $bx, $by, $cx, $cy, $text = 'a', $italic = true, $arc_type = ARC_TYPE_DASH, $width_rate = 1, $text_hole_rate = 1.7); set_text_size($text_size = 10); draw_text('正面図', - $scr_w / 2, 0, O_POS_UP_LEFT, false); set_text_size($text_size = 12); $ay = - $scr_w / 4 + $v / 2 + 2; $by = $ay - $v; $cy = $by; $dy = $by; draw_marked_triangle($ax, $ay, $bx, $by, $cx, $cy, $type_a = 0, $type_b = 0, $type_c = 0, $text_a = '', $text_b = '', $text_c = '', $text_ops_a = 'A', $text_ops_b = 'B', $text_ops_c = 'C', $italic = true, $italic_ops = false, $r = 10); draw_dash_line($ax, $ay, $dx, $dy); draw_arc_mark($tx, $ty, $bx, $by, $cx, $cy, $text = 'a', $italic = true, $arc_type = ARC_TYPE_DASH, $width_rate = 2, $text_hole_rate = 1.7); set_text_margin($text_margin = 2); draw_text('H(D)', $dx, $dy, O_POS_UP_CENTER, false); set_text_margin($text_margin = 0); set_text_size($text_size = 10); draw_text('側面図', 0, 0, O_POS_UP_LEFT, false); set_text_size($text_size = 12); $ax = $scr_w / 4 - $h / 6; $bx = $ax - $h / 3; $cx = $bx; $dx = $bx + $h; draw_marked_triangle($ax, $ay, $cx, $cy, $dx, $dy, $type_a = 0, $type_b = 0, $type_c = 0, $text_a = '', $text_b = '', $text_c = '', $text_ops_a = 'A', $text_ops_b = 'C(B)', $text_ops_c = 'D', $italic = true, $italic_ops = false, $r = 10); draw_arc_mark($tx, $ty, $dx, $dy, $ax, $ay, $text = 'a', $italic = true, $arc_type = ARC_TYPE_DASH, $width_rate = 1, $text_hole_rate = 1.7); $hx = $ax; $hy = $by; draw_dash_line($ax, $ay, $hx, $hy); set_text_margin($text_margin = 2); draw_text('H', $hx, $hy, O_POS_UP_CENTER, false); set_text_margin($text_margin = 0); allocate_color('blue'); allocate_text_color('blue'); draw_arc_mark($tx, $ty, $cx, $cy, $dx, $dy, $text = '', $italic = true, $arc_type = ARC_TYPE_DASH, $width_rate = 1.5, $text_hole_rate = 0); $ux = 2; $uy = - $scr_w / 2 + 3; draw_dash_line($tx, $ty, $ux, $uy); draw_formula('{sqrt{3}/2 a}', $size = 12, $ux, $uy, O_POS_MIDDLE_RIGHT); allocate_color('green'); allocate_text_color('green'); draw_arc_mark($tx, $ty, $hx, $hy, $dx, $dy, $text = '', $italic = true, $arc_type = ARC_TYPE_DASH, $width_rate = 0.8, $text_hole_rate = 0); draw_formula('{sqrt{3}/3 a}', $size = 12, $tx, $ty, O_POS_UP_CENTER); allocate_color('red'); allocate_text_color('red'); draw_arc_mark($tx, $ty, $ax, $ay, $hx, $hy, $text = '', $italic = true, $arc_type = ARC_TYPE_DASH, $width_rate = 0.8, $text_hole_rate = 0); draw_formula('{sqrt{6}/3 a}', $size = 12, $tx, $ty, O_POS_MIDDLE_RIGHT); allocate_color('black'); allocate_text_color('black'); set_text_size($text_size = 10); draw_text('立体図', 0, $scr_w / 2, O_POS_UP_LEFT, false); set_text_size($text_size = 12); $ax3 = $len / 2; $ay3 = $h / 3; $az3 = $v; $bx3 = 0; $by3 = 0; $bz3 = 0; $cx3 = $len; $cy3 = 0; $cz3 = 0; $dx3 = $len / 2; $dy3 = $h; $dz3 = 0; $hx3 = $ax3; $hy3 = $ay3; $hz3 = 0; $ang_theta = -deg2rad(50); $ang_varphi = deg2rad(20); $view_r = $len * 5; $f_x = $view_r * 0.5 * cos($ang_theta); $f_y = $view_r * 0.5 * sin($ang_theta); $f_z = $view_r * 0.5 * sin($ang_varphi); $scale2 = 1.8; $rot2 = deg2rad(2); $m2x = $scr_w / 13; $m2y = $scr_w / 5; calc_3dview($ax, $ay, $scale2, $rot2, $m2x, $m2y, $ax3, $ay3, $az3, $f_x, $f_y, $f_z, $view_r, $ang_theta, $ang_varphi); calc_3dview($bx, $by, $scale2, $rot2, $m2x, $m2y, $bx3, $by3, $bz3, $f_x, $f_y, $f_z, $view_r, $ang_theta, $ang_varphi); calc_3dview($cx, $cy, $scale2, $rot2, $m2x, $m2y, $cx3, $cy3, $cz3, $f_x, $f_y, $f_z, $view_r, $ang_theta, $ang_varphi); calc_3dview($dx, $dy, $scale2, $rot2, $m2x, $m2y, $dx3, $dy3, $dz3, $f_x, $f_y, $f_z, $view_r, $ang_theta, $ang_varphi); calc_3dview($hx, $hy, $scale2, $rot2, $m2x, $m2y, $hx3, $hy3, $hz3, $f_x, $f_y, $f_z, $view_r, $ang_theta, $ang_varphi); draw_line($ax, $ay, $bx, $by); draw_line($ax, $ay, $cx, $cy); draw_line($ax, $ay, $dx, $dy); draw_line($bx, $by, $cx, $cy); draw_dash_line($bx, $by, $dx, $dy); draw_line($cx, $cy, $dx, $dy); allocate_color('green'); set_thick($thick = 3); draw_line($dx, $dy, $hx, $hy); set_thick($thick = 1); allocate_color('blue'); draw_line($dx, $dy, ($bx + $cx) / 2, ($by + $cy) / 2); allocate_color('red'); draw_line($ax, $ay, $hx, $hy); draw_text('A', $ax, $ay, O_POS_LOW_CENTER, false); draw_text('B', $bx, $by, O_POS_UP_RIGHT, false); draw_text('C', $cx, $cy, O_POS_UP_LEFT, false); draw_text('D', $dx, $dy, O_POS_LOW_LEFT, false);
テンプレートを選択するとプログラムに追加されます。
set_scale(...);
allocate_color('black');
allocate_color('gray');
allocate_color('red');
allocate_color('blue');
allocate_color('green');
allocate_color('purple');
allocate_bgcolor('white');
transparent_bgcolor();
set_thick($thick = 1);
set_dashlen($dashlen = 7);
set_arrow_size(...);
draw_line(...);
draw_horizontal($y);
draw_vertical($x);
draw_dash_line(...);
draw_rect(...);
draw_arrow_head(...);
draw_xaxis(...);
draw_yaxis(...);
draw_xyaxis();
draw_circle(...);
draw_arc_deg(...);
draw_arc(...);
draw_dash_arc(...);
M_PI = 3.1415926535898
M_PI_2 = pi/2
M_PI_4 = pi/4
fill_rect(...);
fill_circle(...);
fill_arc_deg(...);
fill_triangle(...);
fill_quadrangle(...);
fill_polygon();
fill_toborder($x, $y, $border_color_x, $border_color_y);
allocate_text_color('black');
allocate_text_color('gray');
allocate_text_color('red');
allocate_text_color('blue');
allocate_text_color('green');
allocate_text_color('purple');
allocate_text_bgcolor('white');
transparent_text_bgcolor();
set_text_size($text_size);
set_text_margin($text_margin);
set_mark_size($mark_size);
draw_text(...);
O_POS_LOW_LEFT
O_POS_LOW_RIGHT
O_POS_UP_RIGHT
O_POS_UP_LEFT
O_POS_LOW_CENTER
O_POS_MIDDLE_RIGHT
O_POS_UP_CENTER
O_POS_MIDDLE_LEFT
O_POS_MIDDLE_CENTER
get_o_pos_by_ang($ang);
draw_formula(...);
ARC_TYPE_NONE
ARC_TYPE_SOLID
ARC_TYPE_DASH
BEG_TYPE_ARROW
END_TYPE_ARROW
draw_arc_mark(...);
draw_corner_mark(...);
draw_marked_triangle(...);
CMARK_NONE 0
CMARK_1_ARC 1
CMARK_2_ARC 2
CMARK_D_ARC 3
CMARK_1_PIE 4
CMARK_2_PIE 5
CMARK_D_PIE 6
CMARK_SQUARE
CMARK_CROSS
CMARK_CIRCLE
CMARK_DOT
draw_mark(...);
draw_mark_on_line(...);
draw_mark_on_circle(...);
MARK_1_LINE
MARK_2_LINE
MARK_3_LINE
MARK_SQUARE
MARK_CROSS
MARK_CIRCLE
MARK_DOT
set_x_def_range(...);
df1_ax_b($a, $b);
df1_x_y($x, $y);
df1_2p($x1, $y1, $x2, $y2);
df2_ax2_bx_c(...);
df2_ax_p2_q(...);
df2_a_x_al_x_be(...);
df_y_fx($y_fx);
df_xt_yt(...);
unit_vector(...);
calc_angle(...);
normalize_ang($ang);
calc_da(...);
calc_intersec_pt_of_lines(...);
calc_intersec_pt_of_lns(...);
rot90_vec(...);
rot_vec(...);
calc_perpendicular_bisector(...);
calc_distance(...);
calc_circumscribed_circle(...);
calc_didtance_to_line(...);
calc_foot_of_perpendicular_line(...);
calc_parallel_line(...);
calc_foot_of_perpendicular_circle(...);
calc_intersec_pts_of_line_circle(...);
calc_intersec_pts_of_circles(...);
calc_inscribed_circle(...);
calc_2p_arc(...);
calc_3dview(...);
clear_canvas();
set_alphablending($alpha = 50);
set_antialias($antialias = true);
transparent_gif_bgcolor();
xf($x)
x_rev($x)
yf($y)
y_rev($y)
作図プログラムをコンパイルして図形を仮表示する
仮表示
作図プログラムをサーバに保存するには、やる勉にログインしてください。
日付順
名前順
図形の新規作成
ログイン
図形の新規作成
ログイン
このページの先頭へ