Skip to content

Commit 76811bf

Browse files
committed
Added ZERO vector constants
1 parent 8556a1e commit 76811bf

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Compatible with GDMC-HTTP **>=1.0.0, <2.0.0** and Minecraft **1.20.2**.
44

55
**Additions:**
6+
- Added ZERO_2D/ZERO_3D/ZERO constants to `vector_tools`. (Thanks [Flashing-Blinkenlights](https://github.com/Flashing-Blinkenlights)!)
67
- Added various ordered vector list constants to `vector_tools`. (Thanks [Flashing-Blinkenlights](https://github.com/Flashing-Blinkenlights)!)
78
- Added `utils.rotateSequence`. (Thanks [Flashing-Blinkenlights](https://github.com/Flashing-Blinkenlights)!)
89

src/gdpc/vector_tools.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def __iter__(self) -> Iterator[bool]: ...
7575
# == constants ==
7676

7777

78+
ZERO_2D = ivec2(0, 0)
7879
X_2D = ivec2(1, 0)
7980
Y_2D = ivec2(0, 1)
8081
XY_2D: ivec2 = X_2D + Y_2D
@@ -121,7 +122,7 @@ def _spiraloidDirections3D(
121122
if include_up: yield UP_3D # ...the UP vector...
122123
if top_pattern: yield from (UP_3D + c for c in top_pattern) # ...the upward diagonal vectors...
123124
if center_pattern: yield from center_pattern[:len(center_pattern)//2] # ...the first half of the horizontal vectors...
124-
if include_center: yield ivec3(0, 0, 0) # ...the origin...
125+
if include_center: yield ZERO_3D # ...the origin...
125126
if center_pattern: yield from center_pattern[len(center_pattern)//2:] # ...the second half of the horizontal vectors...
126127
if bottom_pattern: yield from (DOWN_3D + c for c in bottom_pattern) # ...the downward diagonal vectors...
127128
if include_down: yield DOWN_3D # ...and the DOWN vector.
@@ -147,6 +148,8 @@ def _symmetricSpiraloidDirections3D(
147148
# == constants ==
148149

149150

151+
ZERO_3D = ivec3(0, 0, 0)
152+
150153
X_3D = ivec3(1, 0, 0)
151154
Y_3D = ivec3(0, 1, 0)
152155
Z_3D = ivec3(0, 0, 1)
@@ -211,6 +214,7 @@ def _symmetricSpiraloidDirections3D(
211214
# ==== aliases ====
212215

213216

217+
ZERO: ivec3 = ZERO_3D
214218
X: ivec3 = X_3D
215219
Y: ivec3 = Y_3D
216220
Z: ivec3 = Z_3D

0 commit comments

Comments
 (0)