topologicpy 0.7.5__py3-none-any.whl → 0.7.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- topologicpy/Cell.py +62 -53
- topologicpy/CellComplex.py +10 -8
- topologicpy/Edge.py +21 -16
- topologicpy/EnergyModel.py +20 -13
- topologicpy/Face.py +23 -25
- topologicpy/Graph.py +385 -217
- topologicpy/Grid.py +23 -11
- topologicpy/Honeybee.py +16 -15
- topologicpy/Neo4j.py +22 -10
- topologicpy/Plotly.py +49 -62
- topologicpy/Shell.py +79 -54
- topologicpy/Topology.py +95 -50
- topologicpy/Vector.py +4 -2
- topologicpy/Vertex.py +64 -42
- topologicpy/Wire.py +23 -12
- topologicpy/version.py +1 -1
- {topologicpy-0.7.5.dist-info → topologicpy-0.7.8.dist-info}/METADATA +1 -1
- topologicpy-0.7.8.dist-info/RECORD +33 -0
- topologicpy-0.7.5.dist-info/RECORD +0 -33
- {topologicpy-0.7.5.dist-info → topologicpy-0.7.8.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.5.dist-info → topologicpy-0.7.8.dist-info}/WHEEL +0 -0
- {topologicpy-0.7.5.dist-info → topologicpy-0.7.8.dist-info}/top_level.txt +0 -0
topologicpy/Face.py
CHANGED
@@ -942,7 +942,7 @@ class Face():
|
|
942
942
|
return eb
|
943
943
|
|
944
944
|
@staticmethod
|
945
|
-
def FacingToward(face, direction: list = [0,0,-1], asVertex: bool = False, tolerance: float = 0.0001) -> bool:
|
945
|
+
def FacingToward(face, direction: list = [0,0,-1], asVertex: bool = False, mantissa: int = 6, tolerance: float = 0.0001) -> bool:
|
946
946
|
"""
|
947
947
|
Returns True if the input face is facing toward the input direction.
|
948
948
|
|
@@ -954,6 +954,8 @@ class Face():
|
|
954
954
|
The input direction. The default is [0,0,-1].
|
955
955
|
asVertex : bool , optional
|
956
956
|
If set to True, the direction is treated as an actual vertex in 3D space. The default is False.
|
957
|
+
mantissa : int , optional
|
958
|
+
The desired length of the mantissa. The default is 6.
|
957
959
|
tolerance : float , optional
|
958
960
|
The desired tolerance. The default is 0.0001.
|
959
961
|
|
@@ -963,22 +965,16 @@ class Face():
|
|
963
965
|
True if the face is facing toward the direction. False otherwise.
|
964
966
|
|
965
967
|
"""
|
968
|
+
from topologicpy.Vertex import Vertex
|
966
969
|
from topologicpy.Vector import Vector
|
967
970
|
|
968
|
-
faceNormal = Face.Normal(face)
|
971
|
+
faceNormal = Face.Normal(face, mantissa=mantissa)
|
969
972
|
faceCenter = Face.VertexByParameters(face,0.5,0.5)
|
970
|
-
cList = [
|
971
|
-
try:
|
972
|
-
vList = [direction.X(), direction.Y(), direction.Z()]
|
973
|
-
except:
|
974
|
-
try:
|
975
|
-
vList = [direction[0], direction[1], direction[2]]
|
976
|
-
except:
|
977
|
-
raise Exception("Face.FacingToward - Error: Could not get the vector from the input direction")
|
973
|
+
cList = [Vertex.X(faceCenter, mantissa=mantissa), Vertex.Y(faceCenter, mantissa=mantissa), Vertex.Z(faceCenter, mantissa=mantissa)]
|
978
974
|
if asVertex:
|
979
|
-
dV = [
|
975
|
+
dV = [direction[0]-cList[0], direction[1]-cList[1], direction[2]-cList[2]]
|
980
976
|
else:
|
981
|
-
dV =
|
977
|
+
dV = direction
|
982
978
|
uV = Vector.Normalize(dV)
|
983
979
|
dot = sum([i*j for (i, j) in zip(uV, faceNormal)])
|
984
980
|
if dot < tolerance:
|
@@ -1322,9 +1318,10 @@ class Face():
|
|
1322
1318
|
max_d = distances[-1]*1.05
|
1323
1319
|
edges = []
|
1324
1320
|
for target in targets:
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1321
|
+
if Vertex.Distance(vertex, target) > tolerance:
|
1322
|
+
e = Edge.ByVertices(vertex, target)
|
1323
|
+
e = Edge.SetLength(e, length=max_d, bothSides=False)
|
1324
|
+
edges.append(e)
|
1328
1325
|
shell = Topology.Slice(face, Cluster.ByTopologies(edges))
|
1329
1326
|
faces = Topology.Faces(shell)
|
1330
1327
|
final_faces = []
|
@@ -1987,7 +1984,7 @@ class Face():
|
|
1987
1984
|
return Face.ByWire(wire, tolerance=tolerance)
|
1988
1985
|
|
1989
1986
|
@staticmethod
|
1990
|
-
def Triangulate(face, mode: int = 0, meshSize: float = None, tolerance: float = 0.0001) -> list:
|
1987
|
+
def Triangulate(face, mode: int = 0, meshSize: float = None, mantissa: int = 6, tolerance: float = 0.0001) -> list:
|
1991
1988
|
"""
|
1992
1989
|
Triangulates the input face and returns a list of faces.
|
1993
1990
|
|
@@ -1995,8 +1992,6 @@ class Face():
|
|
1995
1992
|
----------
|
1996
1993
|
face : topologic_core.Face
|
1997
1994
|
The input face.
|
1998
|
-
tolerance : float , optional
|
1999
|
-
The desired tolerance. The default is 0.0001.
|
2000
1995
|
mode : int , optional
|
2001
1996
|
The desired mode of meshing algorithm. Several options are available:
|
2002
1997
|
0: Classic
|
@@ -2012,6 +2007,10 @@ class Face():
|
|
2012
2007
|
meshSize : float , optional
|
2013
2008
|
The desired size of the mesh when using the "mesh" option. If set to None, it will be
|
2014
2009
|
calculated automatically and set to 10% of the overall size of the face.
|
2010
|
+
mantissa : int , optional
|
2011
|
+
The desired length of the mantissa. The default is 6.
|
2012
|
+
tolerance : float , optional
|
2013
|
+
The desired tolerance. The default is 0.0001.
|
2015
2014
|
|
2016
2015
|
Returns
|
2017
2016
|
-------
|
@@ -2073,7 +2072,6 @@ class Face():
|
|
2073
2072
|
warnings.warn("Face.Triangulate - Error: Could not import gmsh. Please try to install gmsh manually. Returning None.")
|
2074
2073
|
return None
|
2075
2074
|
|
2076
|
-
import topologic_core as topologic
|
2077
2075
|
from topologicpy.Vertex import Vertex
|
2078
2076
|
from topologicpy.Wire import Wire
|
2079
2077
|
from topologicpy.Face import Face
|
@@ -2084,8 +2082,8 @@ class Face():
|
|
2084
2082
|
if not meshSize:
|
2085
2083
|
bounding_face = Face.BoundingRectangle(face)
|
2086
2084
|
bounding_face_vertices = Face.Vertices(bounding_face)
|
2087
|
-
bounding_face_vertices_x = [Vertex.X(i) for i in bounding_face_vertices]
|
2088
|
-
bounding_face_vertices_y = [Vertex.Y(i) for i in bounding_face_vertices]
|
2085
|
+
bounding_face_vertices_x = [Vertex.X(i, mantissa=mantissa) for i in bounding_face_vertices]
|
2086
|
+
bounding_face_vertices_y = [Vertex.Y(i, mantissa=mantissa) for i in bounding_face_vertices]
|
2089
2087
|
width = max(bounding_face_vertices_x)-min(bounding_face_vertices_x)
|
2090
2088
|
length = max(bounding_face_vertices_y)-min(bounding_face_vertices_y)
|
2091
2089
|
meshSize = max([width,length])//10
|
@@ -2095,7 +2093,7 @@ class Face():
|
|
2095
2093
|
external_vertices = Wire.Vertices(face_external_boundary)
|
2096
2094
|
external_vertex_number = len(external_vertices)
|
2097
2095
|
for i in range(external_vertex_number):
|
2098
|
-
gmsh.model.geo.addPoint(Vertex.X(external_vertices[i]), Vertex.Y(external_vertices[i]), Vertex.Z(external_vertices[i]), meshSize, i+1)
|
2096
|
+
gmsh.model.geo.addPoint(Vertex.X(external_vertices[i], mantissa=mantissa), Vertex.Y(external_vertices[i], mantissa=mantissa), Vertex.Z(external_vertices[i], mantissa=mantissa), meshSize, i+1)
|
2099
2097
|
for i in range(external_vertex_number):
|
2100
2098
|
if i < external_vertex_number-1:
|
2101
2099
|
gmsh.model.geo.addLine(i+1, i+2, i+1)
|
@@ -2114,7 +2112,7 @@ class Face():
|
|
2114
2112
|
internal_vertices = Wire.Vertices(face_internal_boundary)
|
2115
2113
|
internal_vertex_number = len(internal_vertices)
|
2116
2114
|
for j in range(internal_vertex_number):
|
2117
|
-
gmsh.model.geo.addPoint(Vertex.X(internal_vertices[j]), Vertex.Y(internal_vertices[j]), Vertex.Z(internal_vertices[j]), meshSize, current_vertex_number+j+1)
|
2115
|
+
gmsh.model.geo.addPoint(Vertex.X(internal_vertices[j]), Vertex.Y(internal_vertices[j], mantissa=mantissa), Vertex.Z(internal_vertices[j], mantissa=mantissa), meshSize, current_vertex_number+j+1)
|
2118
2116
|
for j in range(internal_vertex_number):
|
2119
2117
|
if j < internal_vertex_number-1:
|
2120
2118
|
gmsh.model.geo.addLine(current_vertex_number+j+1, current_vertex_number+j+2, current_edge_number+j+1)
|
@@ -2160,7 +2158,7 @@ class Face():
|
|
2160
2158
|
if len(vertices) == 3: # Already a triangle
|
2161
2159
|
return [face]
|
2162
2160
|
origin = Topology.Centroid(face)
|
2163
|
-
normal = Face.Normal(face)
|
2161
|
+
normal = Face.Normal(face, mantissa=mantissa)
|
2164
2162
|
flatFace = Topology.Flatten(face, origin=origin, direction=normal)
|
2165
2163
|
|
2166
2164
|
if mode == 0:
|
@@ -2179,7 +2177,7 @@ class Face():
|
|
2179
2177
|
finalFaces = []
|
2180
2178
|
for f in shell_faces:
|
2181
2179
|
f = Topology.Unflatten(f, origin=origin, direction=normal)
|
2182
|
-
if Face.Angle(face, f) > 90:
|
2180
|
+
if Face.Angle(face, f, mantissa=mantissa) > 90:
|
2183
2181
|
wire = Face.ExternalBoundary(f)
|
2184
2182
|
wire = Wire.Invert(wire)
|
2185
2183
|
f = Face.ByWire(wire)
|