mathmaker  0.6(alpha)
mamk_misc/doc/mathmaker4doxygen/maintenance/autotest/obj_test/geo_test/triangle_test.py
00001 # -*- coding: utf-8 -*-
00002 
00003 # Mathmaker creates automatically maths exercises sheets
00004 # with their answers
00005 # Copyright 2006-2014 Nicolas Hainaux <nico_h@users.sourceforge.net>
00006 
00007 # This file is part of Mathmaker.
00008 
00009 # Mathmaker is free software; you can redistribute it and/or modify
00010 # it under the terms of the GNU General Public License as published by
00011 # the Free Software Foundation; either version 3 of the License, or
00012 # any later version.
00013 
00014 # Mathmaker is distributed in the hope that it will be useful,
00015 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 # GNU General Public License for more details.
00018 
00019 # You should have received a copy of the GNU General Public License
00020 # along with Mathmaker; if not, write to the Free Software
00021 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023 import os
00024 import sys
00025 #import locale
00026 
00027 #from lib.common import default
00028 
00029 from core import *
00030 from core.base_calculus import *
00031 from core.base_geometry import *
00032 from core.geometry import *
00033 
00034 from maintenance.autotest import common
00035 
00036 #try:
00037 #   locale.setlocale(locale.LC_ALL, default.LANGUAGE + '.' + default.ENCODING)
00038 #except:
00039 #    locale.setlocale(locale.LC_ALL, '')
00040 
00041 check = common.check
00042 
00043 
00044 def action():
00045     if common.verbose:
00046         os.write(common.output, bytes("--- [GEO] TRIANGLE \n", 'utf-8'))
00047 
00048     # Don't forget to uncomment the convenient lines above if a test
00049     # requires to use the locale module.
00050 
00051     # 1
00052     t1 = Triangle((("Z", "E", "P"),
00053                    {'side0':4, 'angle1':64, 'side1':5}
00054                   ),
00055                   rotate_around_isobarycenter=115
00056                  )
00057     t1.side0.set_label(Value(4, unit='cm'))
00058     t1.side1.set_label(Value(5, unit='cm'))
00059     t1.side2.set_label(Value(4.84, unit='cm'))
00060     t1.angle0.set_label(Value('?'))
00061     t1.angle1.set_label(Value(64, unit='\\textdegree'))
00062     t1.angle2.set_label(Value(35, unit='\\textdegree'))
00063     t1.angle0.set_mark('simple')
00064     t1.angle1.set_mark('double')
00065     t1.angle2.set_mark('dotted')
00066 
00067 
00068     check(t1.into_euk(),
00069           ["box -1.33, -0.48, 4.71, 4.6"\
00070            "Z = point(4.11, 0.38)"\
00071            "E = point(2.42, 4)"\
00072            "P = point(-0.73, 0.12)"\
00073            "draw"\
00074            "  (Z.E.P)"\
00075            "  $\\rotatebox{-65}{4 cm}$ Z 115 - 7.5 deg 6.4"\
00076            "  $\\rotatebox{51}{5 cm}$ E 231 - 6.5 deg 8"\
00077            "  $\\rotatebox{3}{4,84 cm}$ Z 183 + 6.7 deg 7.8"\
00078            "  $\\rotatebox{-31}{?}$ Z 149 deg 2.7"\
00079            "  $\\rotatebox{83}{64\\textdegree}$ E 263 deg 2.7"\
00080            "  $\\rotatebox{387}{35\\textdegree}$ P 387 deg 2.7"\
00081            "end"\
00082            "label"\
00083            "  E, Z, P simple"\
00084            "  P, E, Z double"\
00085            "  Z, P, E dotted"\
00086            "  Z 115 + 200 deg"\
00087            "  E 115 - 45 deg"\
00088            "  P 115 + 65 deg"\
00089            "end"])
00090 
00091