class_docstr: Displays a 2D rectangle with optional rounded corners
  
  Parameters
  ----------
  center :  array
      Center of the rectangle
  color : instance of Color
      The fill color to use.
  border_color : instance of Color
      The border color to use.
  border_width : int
      Border width in pixels.
      Line widths > 1px are only
      guaranteed to work when using `border_method='agg'` method.
  height : float
      Length of the rectangle along y-axis
      Defaults to 1.0
  width : float
      Length of the rectangle along x-axis
      Defaults to 1.0
  radius : float | array
      Radii of curvatures of corners in clockwise order from top-left
      Defaults to 0.
  **kwargs : dict
      Keyword arguments to pass to `PolygonVisual`.
class_docstr_tok: ["Displays","a","2D","rectangle","with","optional","rounded","corners","Parameters","--","--","--","--","--","center",":","array","Center","of","the","rectangle","color",":","instance","of","Color","The","fill","color","to","use",".","border_color",":","instance","of","Color","The","border","color","to","use",".","border_width",":","int","Border","width","in","pixels",".","Line","widths",">","1px","are","only","guaranteed","to","work","when","using","`","border_method='agg","'","`","method",".","height",":","float","Length","of","the","rectangle","along","y-axis","Defaults","to","1.0","width",":","float","Length","of","the","rectangle","along","x-axis","Defaults","to","1.0","radius",":","float","|","array","Radii","of","curvatures","of","corners","in","clockwise","order","from","top-left","Defaults","to","0",".","*","*","kwargs",":","dict","Keyword","arguments","to","pass","to","`","PolygonVisual","`","."]
code: def _generate_vertices(center, radius, height, width):
      half_height = height / 2.0
      half_width = width / 2.0
      hw = min(half_height, half_width)
  
      if isinstance(radius, (list, tuple)):
          if len(radius) != 4:
              raise ValueError(
                  "radius must be float or 4 value tuple/list"
                  " (got %s of length %d)" % (type(radius), len(radius))
              )
  
          if (radius > np.ones(4) * hw).all():
              raise ValueError(
                  "Radius of curvature cannot be greater than\
                                    half of min(width, height)"
              )
          radius = np.array(radius, dtype=np.float32)
  
      else:
          if radius > hw:
              raise ValueError(
                  "Radius of curvature cannot be greater than\
                                    half of min(width, height)"
              )
          radius = np.ones(4) * radius
  
      num_segments = (radius / hw * 500.0).astype(int)
  
      bias1 = np.ones(4) * half_width - radius
      bias2 = np.ones(4) * half_height - radius
  
      corner1 = np.empty([num_segments[0] + 1, 3], dtype=np.float32)
      corner2 = np.empty([num_segments[1] + 1, 3], dtype=np.float32)
      corner3 = np.empty([num_segments[2] + 1, 3], dtype=np.float32)
      corner4 = np.empty([num_segments[3] + 1, 3], dtype=np.float32)
  
      start_angle = 0.0
      end_angle = np.pi / 2.0
  
      theta = np.linspace(end_angle, start_angle, num_segments[0] + 1)
  
      corner1[:, 0] = center[0] - bias1[0] - radius[0] * np.sin(theta)
      corner1[:, 1] = center[1] - bias2[0] - radius[0] * np.cos(theta)
      corner1[:, 2] = 0
  
      theta = np.linspace(start_angle, end_angle, num_segments[1] + 1)
  
      corner2[:, 0] = center[0] + bias1[1] + radius[1] * np.sin(theta)
      corner2[:, 1] = center[1] - bias2[1] - radius[1] * np.cos(theta)
      corner2[:, 2] = 0
  
      theta = np.linspace(end_angle, start_angle, num_segments[2] + 1)
  
      corner3[:, 0] = center[0] + bias1[2] + radius[2] * np.sin(theta)
      corner3[:, 1] = center[1] + bias2[2] + radius[2] * np.cos(theta)
      corner3[:, 2] = 0
  
      theta = np.linspace(start_angle, end_angle, num_segments[3] + 1)
  
      corner4[:, 0] = center[0] - bias1[3] - radius[3] * np.sin(theta)
      corner4[:, 1] = center[1] + bias2[3] + radius[3] * np.cos(theta)
      corner4[:, 2] = 0
  
      output = np.concatenate(
          (
              [[center[0], center[1], 0.0]],
              [[center[0] - half_width, center[1], 0.0]],
              corner1,
              [[center[0], center[1] - half_height, 0.0]],
              corner2,
              [[center[0] + half_width, center[1], 0.0]],
              corner3,
              [[center[0], center[1] + half_height, 0.0]],
              corner4,
              [[center[0] - half_width, center[1], 0.0]],
          )
      )
  
      vertices = np.array(output, dtype=np.float32)
      return vertices
  
file_path: vispy/vispy/visuals/rectangle.py
imports: from __future__ import division
  import numpy
  from ..color import Color
  from .polygon import PolygonVisual
label_desc: Use image node_id 2 for calling the RectangleVisual obj's underlying member method code with example usage: obj._generate_vertices(center, radius, height, width) and returns: vertices