Modules
Vertex¶
Vertex and Vertex related functions.
A Vertex is a 3-coordinate class, that can be used to represent a Point3d or a Vector3d Includes utilities to go from/to numpy array and OpenStudio's Point3d
Vertex
¶
Point3d and Vector3d.
Source code in geomeffibem/vertex.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|
__add__(other)
¶
Return a + b.
Source code in geomeffibem/vertex.py
98 99 100 |
|
__eq__(other)
¶
Operator equal. Raises if not passed a Vertex.
Source code in geomeffibem/vertex.py
147 148 149 150 151 |
|
__floordiv__(other)
¶
Divides each coordinate by a scalar.
Source code in geomeffibem/vertex.py
133 134 135 136 137 |
|
__init__(x, y, z)
¶
Vertex constructor.
Source code in geomeffibem/vertex.py
32 33 34 35 36 37 |
|
__mul__(other)
¶
Multiplies each coordinate by a scalar.
Source code in geomeffibem/vertex.py
115 116 117 118 119 |
|
__ne__(other)
¶
Operator not equal.
Source code in geomeffibem/vertex.py
153 154 155 |
|
__neg__()
¶
Return obj negated (-obj).
Source code in geomeffibem/vertex.py
102 103 104 |
|
__repr__()
¶
Repr.
Source code in geomeffibem/vertex.py
157 158 159 160 |
|
__rmul__(other)
¶
Multiplies each coordinate by a scalar.
Source code in geomeffibem/vertex.py
121 122 123 124 125 |
|
__sub__(other)
¶
Return a - b.
Source code in geomeffibem/vertex.py
106 107 108 |
|
__truediv__(other)
¶
Divides each coordinate by a scalar.
Source code in geomeffibem/vertex.py
127 128 129 130 131 |
|
copy()
¶
Make a copy of this Vertex.
Source code in geomeffibem/vertex.py
39 40 41 |
|
cross(other, normalize=False)
¶
Computes the cross product (a x b), which is a vector perpendicular to both a and b.
Source code in geomeffibem/vertex.py
83 84 85 86 87 88 89 90 91 92 |
|
dot(other)
¶
Computes the dot / scalar / inner product product of two vectors.
(a.b).
Source code in geomeffibem/vertex.py
75 76 77 78 79 80 81 |
|
from_Point3d(pt)
staticmethod
¶
Factory method to construct from an openstudio.Point3d.
Source code in geomeffibem/vertex.py
27 28 29 30 |
|
from_numpy(arr)
staticmethod
¶
Factory method to construct from a numpy array (or a list) of 3 coords.
Source code in geomeffibem/vertex.py
18 19 20 21 22 23 24 25 |
|
get_coords_on_plane(plane='xy')
¶
Returns two coordinates on a given plane.
Source code in geomeffibem/vertex.py
43 44 45 46 47 48 49 50 51 52 |
|
length()
¶
Get the length of the vector.
Source code in geomeffibem/vertex.py
54 55 56 |
|
normalize()
¶
Normalize to a length of 1, returns a copy.
Source code in geomeffibem/vertex.py
58 59 60 61 62 |
|
outer_product(other)
¶
Compute the outer product of this by another vector.
Source code in geomeffibem/vertex.py
94 95 96 |
|
setLength(newLength)
¶
Change length of vector, in place.
Source code in geomeffibem/vertex.py
64 65 66 67 68 69 70 71 72 73 |
|
to_Point3d()
¶
Export to an openstudio.Point3d.
Source code in geomeffibem/vertex.py
143 144 145 |
|
to_numpy()
¶
Export to a numpy array of 3 coordinates.
Source code in geomeffibem/vertex.py
139 140 141 |
|
distance(lhs, rhs)
¶
Distance between two vertices.
Source code in geomeffibem/vertex.py
172 173 174 175 176 |
|
distanceFromPointToLine(start, end, test)
¶
Distance between a point and a line.
Source code in geomeffibem/vertex.py
179 180 181 182 183 184 |
|
getAngle(start, end)
¶
Returns the angle between two vectors, in radians.
Source code in geomeffibem/vertex.py
198 199 200 201 202 |
|
getNewellVector(points)
¶
Compute Newell vector from a list of points, direction is same as outward normal magnitude is twice the area.
Source code in geomeffibem/vertex.py
205 206 207 208 209 210 211 212 213 214 215 216 217 |
|
getOutwardNormal(points)
¶
Compute outward normal from a list of points.
Source code in geomeffibem/vertex.py
220 221 222 223 |
|
isAlmostEqual3dPt(v1, v2, tol=0.0127)
¶
Checks if both vertices almost equal within tolerance.
Source code in geomeffibem/vertex.py
166 167 168 169 |
|
isPointOnLineBetweenPoints(start, end, test, tol=0.0127)
¶
Checks whether a Vertex is on a segment.
If the distance(start, test) + distance(test, end) == distance(start, end) then it's on a line But we first check that the distance from the point to the line is also inferior to this tolerance
Source code in geomeffibem/vertex.py
187 188 189 190 191 192 193 194 195 |
|
Surface¶
Surface and Surface3dEdge objects.
A Surface is a collection of Vertex. A Surface3dEdge is a side of a Surface.
Surface
¶
A 3D Surface.
Source code in geomeffibem/surface.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
|
Floor(min_x=0.0, max_x=10.0, min_y=0.0, max_y=10.0, z=0.0)
staticmethod
¶
Create a rectangular floor Surface (outward normal pointing down).
Source code in geomeffibem/surface.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
Rectangle(min_x=0.0, max_x=10.0, min_y=0.0, max_y=10.0, min_z=0.0, max_z=0.0)
staticmethod
¶
Factory method to easily create a rectangular Surface, with ULC convention.
Source code in geomeffibem/surface.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
__init__(vertices, name=None)
¶
Surface constructor.
Source code in geomeffibem/surface.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
__repr__()
¶
Repr.
Source code in geomeffibem/surface.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
|
area()
¶
Compute area of the surface.
Source code in geomeffibem/surface.py
242 243 244 245 |
|
azimuth()
¶
Returns the azimuth of the surface, in radians.
That is the angle between the outwardNormal and the North axis (Y-axis).
Source code in geomeffibem/surface.py
256 257 258 259 260 261 262 263 264 265 266 |
|
from_Point3dVector(points)
staticmethod
¶
Factory method to construct from an openstudio Point3dVector or a list of Point3d.
Source code in geomeffibem/surface.py
98 99 100 101 |
|
from_Surface(openstudio_surface)
staticmethod
¶
Factory method to construct from an openstudio.model.Surface.
Source code in geomeffibem/surface.py
103 104 105 106 107 108 109 110 111 |
|
from_numpy_array(arr)
staticmethod
¶
Factory method to construct from a numpy array of 3-coordinates arrays.
Source code in geomeffibem/surface.py
87 88 89 90 91 92 93 94 95 96 |
|
get_plane()
¶
Returns the Plane of the Surface.
Source code in geomeffibem/surface.py
201 202 203 204 205 206 207 |
|
get_plot_axis()
¶
Returns a string representation of the plane it is on.
TODO: raises if not exactly on 'xy', 'xz' or 'yz'
Source code in geomeffibem/surface.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
|
os_area()
¶
Returns area of the surface via openstudio.
Source code in geomeffibem/surface.py
268 269 270 |
|
os_centroid()
¶
Returns the centroid via openstudio.
Source code in geomeffibem/surface.py
280 281 282 283 284 285 |
|
outwardNormal()
¶
Returns the outward normal (normal unit vector).
Source code in geomeffibem/surface.py
247 248 249 |
|
perimeter()
¶
Returns the perimeter of the surface.
Source code in geomeffibem/surface.py
272 273 274 |
|
plane()
¶
Compute the plane from outwardNormal and the first point, not using OpenStudio.
Source code in geomeffibem/surface.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
plot(name=True, **kwargs)
¶
Calls plot_vertices, cf help(plot_vertices).
Source code in geomeffibem/surface.py
385 386 387 388 389 390 391 |
|
rotate(degrees, axis=None)
¶
Rotates a surface by an amount of degrees.
Args:¶
- degrees (float): the angle to rotate it by, in degrees. Positive means clockwise
- axis (Vertex): if none, uses the Z axis
Returns:¶
- a new Surface object with rotated vertices
Source code in geomeffibem/surface.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
|
rough_centroid()
¶
Returns the centroid calculated in a rough way: the mean of the coordinates.
Source code in geomeffibem/surface.py
276 277 278 |
|
split_into_n_segments(n_segments, axis=None, plot=False)
¶
Splits a surface in N equal segments.
If axis is not passed, it defaults to the first one of the plane eg: for a plane 'xy' it splits on 'x'
Source code in geomeffibem/surface.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
|
tilt()
¶
Returns the tilt of the surface, in radians, that is the angle between the outwardNormal and the Z axis.
Source code in geomeffibem/surface.py
251 252 253 254 |
|
to_OSSurface(model)
¶
Creates an openstudio.model.Surface in the model passed as argument.
Source code in geomeffibem/surface.py
291 292 293 |
|
to_Point3dVector()
¶
Converts vertices to a list openstudio.Point3d.
Source code in geomeffibem/surface.py
287 288 289 |
|
to_Surface3dEdges()
¶
Converts vertex pairs to Surface3dEge.
Source code in geomeffibem/surface.py
299 300 301 302 303 304 305 306 307 308 |
|
to_numpy()
¶
Get a numpy array representing the vertices.
Source code in geomeffibem/surface.py
295 296 297 |
|
translate(translation)
¶
Translates a surface along a translation vector.
Source code in geomeffibem/surface.py
379 380 381 382 383 |
|
Surface3dEge
¶
An Edge has a start and an end Vertex, and a list of surfaces it was found on.
Source code in geomeffibem/surface.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
__eq__(other)
¶
Operator equal.
Source code in geomeffibem/surface.py
57 58 59 60 61 62 63 64 |
|
__init__(start, end, firstSurface)
¶
Constructor.
Source code in geomeffibem/surface.py
31 32 33 34 35 |
|
__ne__(other)
¶
Operator not equal.
Source code in geomeffibem/surface.py
66 67 68 |
|
__repr__()
¶
Repr.
Source code in geomeffibem/surface.py
70 71 72 |
|
containsPoints(testVertex)
¶
Checks whether a Point is on the edge.
It is not almost equal to the start and end points, and, isPointOnLineBetweenPoints(start, end, testVertex) is true.
Source code in geomeffibem/surface.py
37 38 39 40 41 42 43 44 45 46 47 |
|
count()
¶
Number of Surfaces it was found on.
Source code in geomeffibem/surface.py
53 54 55 |
|
length()
¶
Compute distance from start to end.
Source code in geomeffibem/surface.py
49 50 51 |
|
plot_on_first_surface(ax=None)
¶
Plots this segment in red atop the outline of the Surface it came from.
Source code in geomeffibem/surface.py
74 75 76 77 78 79 80 81 |
|
get_surface_from_surface_like(surface_like)
¶
Helper to get a Surface (class) from a surface like object.
Source code in geomeffibem/surface.py
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
|
plot_vertices(surface_like, ax=None, center_axes=False, with_rough_centroid=False, with_os_centroid=False, annotate=True, linewidth=None, force_align=False, name=None, plane=None, annotate_kwargs=dict(color='r', xytext=(5, 5), textcoords='offset points'), **kwargs)
¶
Plot any surface-like object in 2D.
Accepts a Surface, a list or numpy array of Vertex, or an openstudio.model.Surface object
TODO: Assumes the surface is planar and falls exactly on 'xy', 'xz' or 'yz' plane currently
Source code in geomeffibem/surface.py
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 |
|
Plane¶
Plane.
Plane
¶
A 3D Plane.
Equation is ax + by + cz + d = 0
Source code in geomeffibem/plane.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
__init__(a, b, c, d)
¶
Plane constructor.
Source code in geomeffibem/plane.py
14 15 16 17 18 19 |
|
__repr__()
¶
Repr.
Source code in geomeffibem/plane.py
55 56 57 |
|
is_orthogonal()
¶
Checks if the plane is orthogonal.
Source code in geomeffibem/plane.py
25 26 27 |
|
outwardNormal()
¶
The outwardNormal of the plane.
Source code in geomeffibem/plane.py
21 22 23 |
|
pointOnPlane(point, tol=0.001)
¶
Checks whether the Vertex is on the Plane.
Source code in geomeffibem/plane.py
29 30 31 32 33 34 |
|
project(point)
¶
Project a point onto a Plane.
Source code in geomeffibem/plane.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
Polyhedron¶
A Polyhedron is a collection of Surface objects.
It's meant to represent a volume. You can check whether it's enclosed or not.
Polyhedron
¶
A collection of Surfaces, meant to represent a Volume.
Source code in geomeffibem/polyhedron.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
|
__init__(surfaces)
¶
Constructor from a list of Surface objects.
Source code in geomeffibem/polyhedron.py
20 21 22 23 24 25 26 27 28 |
|
calcPolyhedronVolume()
¶
Calculates the Volume of an ENCLOSED Polyhedron.
Source code in geomeffibem/polyhedron.py
119 120 121 122 123 124 125 126 127 128 129 130 |
|
edgesNotTwoForEnclosedVolumeTest(zonePoly)
staticmethod
¶
Counts the number of times an Edge is used.
Returns the ones that isn't used twice (and the ones used twice for debugging/inspection)
Source code in geomeffibem/polyhedron.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
get_surface_by_name(name)
¶
Locate a surface by its name.
Source code in geomeffibem/polyhedron.py
30 31 32 33 34 |
|
isEnclosedVolume()
¶
Checks if the Polyhedron is enclosed, that is all its edges are used exactly twice.
Source code in geomeffibem/polyhedron.py
105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
numVertices()
¶
Counts the total number of vertices for all surfaces.
Source code in geomeffibem/polyhedron.py
36 37 38 39 40 41 |
|
to_eplus_cpp_code()
¶
For my own convenience when writting EnergyPlus tests.
Source code in geomeffibem/polyhedron.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
|
to_os_cpp_code()
¶
For my own convenience when writting OpenStudio tests.
Source code in geomeffibem/polyhedron.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
uniqueVertices()
¶
Get a list of unique vertices (uses Vertex eq operator which has a tolerance).
Source code in geomeffibem/polyhedron.py
43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
updateZonePolygonsForMissingColinearPoints()
¶
Creates a new Polyhedron with extra vertices when a point is found to be on a line segment.
Source code in geomeffibem/polyhedron.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
edgesInBoth(a, b)
¶
Helper function.
Source code in geomeffibem/polyhedron.py
203 204 205 206 207 208 209 210 211 |
|