---
url: /dyad/stable/stdlib/MultibodyComponents/components/PlanarMechanics.FrameVisualizer2D.md
description: >-
  Dyad PlanarMechanics.FrameVisualizer2D docs.  Visualizes a 2D frame as three
  colored axis cylinders (red=x, green=y, blue=z).
---

# `PlanarMechanics.FrameVisualizer2D` {#PlanarMechanics.FrameVisualizer2D}

Visualizes a 2D frame as three colored axis cylinders (red=x, green=y, blue=z).

Attach to any Frame2D connector to display its coordinate axes. The z-axis is not part of the 2D frame but is drawn perpendicular to the plane for visual reference.

This component extends from [`MultibodyComponents.Renderable`](../types/Renderable.md)

## Usage {#Usage}

`MultibodyComponents.PlanarMechanics.FrameVisualizer2D(render=true, color=[0.5, 0.5, 0.5, 1.0], specular_coefficient=1.5, axis_length=MultibodyComponents.world_default_joint_length(), axis_radius=axis_length / 20, z_position=0)`

## Parameters: {#Parameters:}

|                   Name |                  Description | Units |             Default value |
| ----------------------:| ----------------------------:| -----:| -------------------------:|
|               `render` |                              |     – |                      true |
|                `color` |                              |     – |      \[0.5, 0.5, 0.5, 1.0] |
| `specular_coefficient` |                              |     – |                       1.5 |
|          `axis_length` |    Length of the axis arrows |     – | MultibodyCo...nt_length() |
|          `axis_radius` | Radius of the axis cylinders |     – |          axis_length / 20 |
|           `z_position` |     z-position in animations |     – |                         0 |

## Connectors {#Connectors}

* `frame_a` - Coordinate system (2-dim.) fixed to the component with one cut-force and cut-torque.

All variables are resolved in the planar world frame. ([`Frame2D`](/stdlib/Dyad/connectors/Frame2D#Frame2D))

## Variables {#Variables}

|  Name | Description | Units |
| -----:| -----------:| -----:|
| `phi` | Frame angle |   rad |

## Behavior {#Behavior}

## Source {#Source}

```dyad
"""
Visualizes a 2D frame as three colored axis cylinders (red=x, green=y, blue=z).

Attach to any Frame2D connector to display its coordinate axes. The z-axis
is not part of the 2D frame but is drawn perpendicular to the plane for
visual reference.
"""
component FrameVisualizer2D
  extends MultibodyComponents.Renderable
  frame_a = Frame2D() {}
  "Length of the axis arrows"
  parameter axis_length::Real = MultibodyComponents.world_default_joint_length()
  "Radius of the axis cylinders"
  parameter axis_radius::Real = axis_length / 20
  "z-position in animations"
  parameter z_position::Real = 0
  "X-axis shape (red)"
  x_shape = MultibodyComponents.CylinderShape(color = [1, 0, 0, 1], r = [frame_a.x, frame_a.y, z_position], R = MultibodyComponents.RR(MultibodyComponents.axis_rotation(3, phi)), width_direction = [0, 0, 1], length = axis_length, width = 2 * axis_radius, height = 2 * axis_radius)
  "Y-axis shape (green)"
  y_shape = MultibodyComponents.CylinderShape(color = [0, 1, 0, 1], r = [frame_a.x, frame_a.y, z_position], R = MultibodyComponents.RR(MultibodyComponents.axis_rotation(3, phi)), length_direction = [0, 1, 0], width_direction = [0, 0, 1], length = axis_length, width = 2 * axis_radius, height = 2 * axis_radius)
  "Z-axis shape (blue)"
  z_shape = MultibodyComponents.CylinderShape(color = [0, 0, 1, 1], r = [frame_a.x, frame_a.y, z_position], R = MultibodyComponents.RR(MultibodyComponents.axis_rotation(3, phi)), length_direction = [0, 0, 1], width_direction = [1, 0, 0], length = axis_length, width = 2 * axis_radius, height = 2 * axis_radius)
  "Frame angle"
  variable phi::Angle
relations
  phi = frame_a.phi
end
```

```dyad
"""
Visualizes a 2D frame as three colored axis cylinders (red=x, green=y, blue=z).

Attach to any Frame2D connector to display its coordinate axes. The z-axis
is not part of the 2D frame but is drawn perpendicular to the plane for
visual reference.
"""
component FrameVisualizer2D
  parameter render::Boolean = true
  parameter color::Real[4] = [0.5, 0.5, 0.5, 1.0]
  parameter specular_coefficient::Real = 1.5
  frame_a = Frame2D() {}
  "Length of the axis arrows"
  parameter axis_length::Real = MultibodyComponents.world_default_joint_length()
  "Radius of the axis cylinders"
  parameter axis_radius::Real = axis_length / 20
  "z-position in animations"
  parameter z_position::Real = 0
  "X-axis shape (red)"
  x_shape = MultibodyComponents.CylinderShape(color = [1, 0, 0, 1], r = [frame_a.x, frame_a.y, z_position], R = MultibodyComponents.RR(MultibodyComponents.axis_rotation(3, phi)), width_direction = [0, 0, 1], length = axis_length, width = 2 * axis_radius, height = 2 * axis_radius)
  "Y-axis shape (green)"
  y_shape = MultibodyComponents.CylinderShape(color = [0, 1, 0, 1], r = [frame_a.x, frame_a.y, z_position], R = MultibodyComponents.RR(MultibodyComponents.axis_rotation(3, phi)), length_direction = [0, 1, 0], width_direction = [0, 0, 1], length = axis_length, width = 2 * axis_radius, height = 2 * axis_radius)
  "Z-axis shape (blue)"
  z_shape = MultibodyComponents.CylinderShape(color = [0, 0, 1, 1], r = [frame_a.x, frame_a.y, z_position], R = MultibodyComponents.RR(MultibodyComponents.axis_rotation(3, phi)), length_direction = [0, 0, 1], width_direction = [1, 0, 0], length = axis_length, width = 2 * axis_radius, height = 2 * axis_radius)
  "Frame angle"
  variable phi::Angle
relations
  phi = frame_a.phi
metadata {}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
