toAffine method

Converts the projective point to an affine point.

Implementation

ProjectivAffinePoint toAffine() {
  ///  Current y-coordinate
  final y = _coords[1];

  ///  Current z-coordinate
  final z = _coords[2];

  if (y == BigInt.zero || z == BigInt.zero) {
    return ProjectivAffinePoint.zero(curve);
  }

  /// Scale the point to its affine form
  scale();

  /// Scaled x-coordinate
  final x = _coords[0];

  /// Affine y-coordinate
  final yAffine = y;

  return ProjectivAffinePoint(curve, x, yAffine, order: order);
}