Skip to content

Instantly share code, notes, and snippets.

@jkseppan
Created December 19, 2021 06:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkseppan/11f40e2866460515067bca7ebcfabb0d to your computer and use it in GitHub Desktop.
Save jkseppan/11f40e2866460515067bca7ebcfabb0d to your computer and use it in GitHub Desktop.
import itertools as it
import numpy as np
def cube24(points):
points = np.asarray(points)
pp = [(0, 1, 2), (1, 2, 0), (2, 0, 1)]
sp = [(1, 1, 1), (-1, -1, 1), (-1, 1, -1), (1, -1, -1)]
pn = [(0, 2, 1), (1, 0, 2), (2, 1, 0)]
sn = [(-1, 1, 1), (1, -1, 1), (1, 1, -1), (-1, -1, -1)]
for perm, sign in it.chain(it.product(pp, sp), it.product(pn,sn)):
yield points[:,perm] * sign
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment