G1AffinePoint.fromProjective constructor

G1AffinePoint.fromProjective(
  1. G1Projective p
)

Implementation

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