G2AffinePoint.fromProjective constructor

G2AffinePoint.fromProjective(
  1. G2Projective p
)

Implementation

factory G2AffinePoint.fromProjective(G2Projective p) {
  final zInv = p.z.invert() ?? Bls12Fp2.zero();
  final x = p.x * zInv;
  final y = p.y * zInv;
  final tmp = G2AffinePoint(x: x, y: y, infinity: false);
  return G2AffinePoint.conditionalSelect(
    tmp,
    G2AffinePoint.identity(),
    zInv.isZero(),
  );
}