FreeCAD
1# ***************************************************************************
2# * Copyright (c) 2009, 2010 Yorik van Havre <yorik@uncreated.net> *
3# * Copyright (c) 2009, 2010 Ken Cline <cline@frii.com> *
4# * *
5# * This program is free software; you can redistribute it and/or modify *
6# * it under the terms of the GNU Lesser General Public License (LGPL) *
7# * as published by the Free Software Foundation; either version 2 of *
8# * the License, or (at your option) any later version. *
9# * for detail see the LICENCE text file. *
10# * *
11# * This program is distributed in the hope that it will be useful, *
12# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14# * GNU Library General Public License for more details. *
15# * *
16# * You should have received a copy of the GNU Library General Public *
17# * License along with this program; if not, write to the Free Software *
18# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
19# * USA *
20# * *
21# ***************************************************************************
22"""Define geometry functions for manipulating shapes in the Draft Workbench.
23
24These functions are used by different object creation functions
25of the Draft Workbench, both in `Draft.py` and `DraftTools.py`.
26They operate on the internal shapes (`Part::TopoShape`) of different objects
27and on their subelements, that is, vertices, edges, and faces.
28"""
29## \defgroup DRAFTGEOMUTILS DraftGeomUtils
30# \ingroup UTILITIES
31# \brief Shape manipulation utilities for the Draft workbench
32#
33# Shapes manipulation utilities
34
35## \addtogroup DRAFTGEOMUTILS
36# @{
37
38__title__ = "FreeCAD Draft Workbench - Geometry library"39__author__ = "Yorik van Havre, Jacques-Antoine Gaudin, Ken Cline"40__url__ = ["https://www.freecad.org"]41
42# Doesn't need requisites
43from draftgeoutils.linear_algebra import (linearFromPoints,44determinant)45
46# Needs math, Part, and vector tools
47from draftgeoutils.general import NORM48
49from draftgeoutils.general import (precision,50vec,51edg,52getVerts,53v1,54isNull,55isPtOnEdge,56hasCurves,57isAligned,58getQuad,59areColinear,60hasOnlyWires,61geomType,62isValidPath,63findClosest,64getBoundaryAngles)65
66# Needs general functions
67from draftgeoutils.geometry import (findPerpendicular,68findDistance,69getSplineNormal,70get_spline_normal,71getNormal,72get_normal,73getRotation,74isPlanar,75is_planar,76calculatePlacement,77mirror,78are_coplanar,79is_straight_line,80mirror_matrix,81uv_vectors_from_face,82placement_from_face,83placement_from_points,84distance_to_plane,85project_point_on_plane)86
87from draftgeoutils.edges import (findEdge,88orientEdge,89isSameLine,90isLine,91is_line,92invert,93findMidpoint,94getTangent,95get_referenced_edges)96
97from draftgeoutils.faces import (concatenate,98getBoundary,99isCoplanar,100is_coplanar,101bind,102cleanFaces,103removeSplitter)104
105from draftgeoutils.arcs import (isClockwise,106isWideAngle,107arcFrom2Pts,108arcFromSpline)109
110from draftgeoutils.cuboids import (isCubic,111getCubicDimensions)112
113# Needs geometry functions
114from draftgeoutils.circle_inversion import (pointInversion,115polarInversion,116circleInversion)117
118# Needs edges functions
119from draftgeoutils.sort_edges import (sortEdges,120sortEdgesOld)121
122from draftgeoutils.intersections import (findIntersection,123wiresIntersect,124connect,125angleBisection)126
127from draftgeoutils.wires import (findWires,128findWiresOld,129findWiresOld2,130flattenWire,131superWire,132isReallyClosed,133curvetowire,134curvetosegment,135rebaseWire,136removeInterVertices,137cleanProjection,138tessellateProjection,139get_placement_perpendicular_to_wire,140get_extended_wire)141
142# Needs wires functions
143from draftgeoutils.fillets import (fillet,144filletWire)145
146# Needs intersections functions
147from draftgeoutils.offsets import (pocket2d,148offset,149offsetWire)150
151from draftgeoutils.circles import (findClosestCircle,152getCircleFromSpline,153circlefrom1Line2Points,154circlefrom2Lines1Point,155circleFrom2LinesRadius,156circleFrom3LineTangents,157circleFromPointLineRadius,158circleFrom2PointsRadius,159findHomotheticCenterOfCircles,160findRadicalAxis,161findRadicalCenter)162
163from draftgeoutils.circles_apollonius import (outerSoddyCircle,164innerSoddyCircle,165circleFrom3CircleTangents)166
167# Needs circles_apollonius functions
168# These functions are not imported because they are incomplete;
169# they require pre-requisite functions that haven't been written
170# from draftgeoutils.circles_incomplete import (circleFrom2tan1pt,
171# circleFrom2tan1rad,
172# circleFrom1tan2pt,
173# circleFrom1tan1pt1rad,
174# circleFrom3tan)
175
176## @}
177