_createAxis()

in viewer/src/renderer/AxesRenderer.js [97:146]


  _createAxis(options) {
    const color = options.color;
    const euler = options.euler;
    const coneLength = options.coneLength;
    const coneRadius = options.coneRadius;
    const cylinderLength = options.cylinderLength;
    const cylinderRadius = options.cylinderRadius;

    const rotation = new Matrix4().multiply(
      new Matrix4().makeRotationFromEuler(new Euler().fromArray(euler)),
    );
    const material = new MeshPhongMaterial({
      color,
      flatShading: true,
    });

    const cylinderSegments = 12;
    const cylinder = new Mesh(
      new CylinderGeometry(
        cylinderRadius,
        cylinderRadius,
        cylinderLength,
        cylinderSegments,
      ),
      material.clone(),
    );
    cylinder.applyMatrix4(
      rotation
        .clone()
        .multiply(new Matrix4().makeTranslation(0, cylinderLength / 2, 0)),
    );

    const coneSegments = 12;
    const cone = new Mesh(
      new ConeGeometry(coneRadius, coneLength, coneSegments),
      material.clone(),
    );
    cone.applyMatrix4(
      rotation
        .clone()
        .multiply(
          new Matrix4().makeTranslation(0, cylinderLength + coneLength / 2, 0),
        ),
    );

    const axis = new Object3D();
    axis.add(cylinder, cone);

    return axis;
  }