Vertices

Vertices

Introduction

  • A vertex is a point in 3d space.
  • For example: [0, 1, 1] Is a point
  • Vertices are the meeting point between edges.
  • Multiple vertices can be used to define shapes.
  • The vertices for a cube would be: [0,0,0], [1,0,0], [1,1,0], [0,1,0], [0,0,1], [1,0,1], [1,1,1], [0,1,1] a cube rendered in 3d space

Code (Python)

import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

v = np.array([[0,0,0], [1,0,0], [1,1,0], [0,1,0], [0,0,1], [1,0,1], [1,1,1], [0,1,1]])

# ax.scatter expects the the vertices to be stored in 3 arrays, one for each dimension
x, y, z = [list(i) for i in zip(*v)]

ax.scatter(x, y, z, c='r', marker='o')

plt.show()