docstr: Tests the computation of vertex normals for a regular octahedral.
docstr_tok: ["Tests","the","computation","of","vertex","normals","for","a","regular","octahedral","."]
code: def test_vertex_normals_random(self):
      """Tests the computation of vertex normals for a regular octahedral."""
      tensor_vertex_size = np.random.randint(1, 3)
      tensor_out_shape = np.random.randint(
          1, 5, size=tensor_vertex_size
      )
      tensor_out_shape = tensor_out_shape.tolist()
  
      with self.subTest(name="triangular_faces"):
          vertex_on_axes = np.array(
              (
                  (0.0, 0.0, 1),
                  (1.0, 0.0, 0.0),
                  (0.0, 1.0, 0.0),
                  (0.0, 0.0, -1.0),
                  (-1.0, 0.0, 0.0),
                  (0.0, -1.0, 0.0),
              ),
              dtype=np.float32,
          )
          vertex_on_axes = vertex_on_axes.reshape(
              [1] * tensor_vertex_size + [6, 3]
          )
          index_init = np.array(
              (
                  (0, 1, 2),
                  (0, 2, 4),
                  (0, 4, 5),
                  (0, 5, 1),
                  (3, 2, 1),
                  (3, 4, 2),
                  (3, 5, 4),
                  (3, 1, 5),
              ),
              dtype=np.int32,
          )
          index_init = index_init.reshape(
              [1] * tensor_vertex_size + [8, 3]
          )
          index_init = np.tile(index_init, tensor_out_shape + [1, 1])
          vertex_scale = np.random.uniform(
              0.5, 5.0, tensor_out_shape + [1] * 2
          )
          vertex_init = vertex_on_axes * vertex_scale
          expected = vertex_on_axes * (vertex_scale * 0.0 + 1.0)
  
          vertex_tensor = tf.convert_to_tensor(value=vertex_init)
          index_tensor = tf.convert_to_tensor(value=index_init)
  
          self.assertAllClose(
              normals.vertex_normals(vertex_tensor, index_tensor),
              expected,
          )
  
      with self.subTest(name="polygon_faces"):
          num_vertices = np.random.randint(4, 8)
          poly_vertices = []
          rad_step = np.pi * 2.0 / num_vertices
          for i in range(num_vertices):
              poly_vertices.append(
                  [np.cos(i * rad_step), np.sin(i * rad_step), 0]
              )
          vertex_init = np.array(poly_vertices, dtype=np.float32)
          vertex_init = vertex_init.reshape(
              [1] * tensor_vertex_size + [-1, 3]
          )
          vertex_init = vertex_init * vertex_scale
          index_init = np.arange(num_vertices, dtype=np.int32)
          index_init = index_init.reshape(
              [1] * tensor_vertex_size + [1, -1]
          )
          index_init = np.tile(index_init, tensor_out_shape + [1, 1])
          expected = np.array((0.0, 0.0, 1.0), dtype=np.float32)
          expected = expected.reshape([1] * tensor_vertex_size + [1, 3])
          expected = np.tile(
              expected, tensor_out_shape + [num_vertices, 1]
          )
          vertex_tensor = tf.convert_to_tensor(value=vertex_init)
          index_tensor = tf.convert_to_tensor(value=index_init)
  
          self.assertAllClose(
              normals.vertex_normals(vertex_tensor, index_tensor),
              expected,
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  from six.moves import range
  import tensorflow
  from tensorflow_graphics.geometry.representation.mesh import normals
  from tensorflow_graphics.util import test_case
label_desc: Use image node_id 15 for calling the MeshTest obj's underlying member method code with example usage: obj.test_vertex_normals_random() without return types