transformVertex function

void transformVertex(
  1. dynamic vertexPosition,
  2. Vector3 mvPosition,
  3. Vector2 center,
  4. dynamic scale,
  5. double? sin,
  6. double? cos,
)

Implementation

void transformVertex(vertexPosition, Vector3 mvPosition, Vector2 center, scale,
    double? sin, double? cos) {
  // compute position in camera space
  //print("vooot"+vertexPosition.toString());
  var vertexPosition2= Vector2(vertexPosition.x, vertexPosition.y);
  var scale2= Vector2(scale.x, scale.y);

  _alignedPosition
      .subVectors(vertexPosition2, center)
      .addScalar(0.5)
      .multiply(scale2);

  // to check if rotation is not zero
  if (sin != null && cos != null) {
    _rotatedPosition.x =
        (cos * _alignedPosition.x) - (sin * _alignedPosition.y);
    _rotatedPosition.y =
        (sin * _alignedPosition.x) + (cos * _alignedPosition.y);
  } else {
    _rotatedPosition.copy(_alignedPosition);
  }

  vertexPosition.copy(mvPosition);
  vertexPosition.x += _rotatedPosition.x;
  vertexPosition.y += _rotatedPosition.y;

  // transform to world space
  vertexPosition.applyMatrix4(_viewWorldMatrix);
}