MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with PyCAM. If not, see <http://www.gnu.org/licenses/>. """ __all__ = ["utils", "Line", "Model", "Path", "Plane", "Triangle", "PolygonExtractor", "TriangleKdtree", "intersection", "kdtree", "Matrix", "Polygon", "Letters", "PointUtils"] from pycam.Geometry.PointUtils import * from pycam.Geometry.utils import epsilon, ceil from pycam.Utils import log import types log = log.get_logger() import math def get_bisector(p1, p2, p3, up_vector): """ Calculate the bisector between p1, p2 and p3, whereas p2 is the origin of the angle. """ d1 = pnormalized(psub(p2, p1)) d2 = pnormalized(psub(p2, p3)) bisector_dir = pnormalized(padd(d1, d2)) if bisector_dir is None: # the two vectors pointed to opposite directions bisector_dir = pnormalized(pcross(d1, up_vector)) else: skel_up_vector = pcross(bisector_dir, psub(p2, p1))
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with PyCAM. If not, see <http://www.gnu.org/licenses/>. """ from pycam.Geometry import epsilon, number, TransformableContainer, IDGenerator from pycam.Geometry.Line import Line from pycam.Geometry.Plane import Plane from pycam.Geometry.PointUtils import padd, pcross, pdist, pdiv, pdot, pis_inside, pmul, pnorm, \ pnormalized, psub from pycam.Geometry.utils import get_bisector from pycam.Utils import log log = log.get_logger() # import later to avoid circular imports # from pycam.Geometry.Model import ContourModel try: import OpenGL.GL as GL GL_enabled = True except ImportError: GL_enabled = False LINE_WIDTH_INNER = 0.7 LINE_WIDTH_OUTER = 1.3 class PolygonInTree(IDGenerator): """ This class is a wrapper around Polygon objects that is used for sorting.