toAffine method
Converts the projective point to an affine point.
y and z
represent the current y and z coordinates.
If y is zero or z
is zero, the method returns an infinity point.
The point is scaled using the scale method, and the scaled x and y coordinates
are assigned to x and yAffine
respectively. An affine point is then created
with the updated coordinates and returned.
Implementation
AffinePointt toAffine() {
/// Current y-coordinate
final y = _coords[1];
/// Current z-coordinate
final z = _coords[2];
if (y == BigInt.zero || z == BigInt.zero) {
return AffinePointt.infinity(curve);
}
/// Scale the point to its affine form
scale();
/// Scaled x-coordinate
final x = _coords[0];
/// Affine y-coordinate
final yAffine = y;
return AffinePointt(curve, x, yAffine, order: order);
}