ProjectiveECCPoint.fromAffine constructor

ProjectiveECCPoint.fromAffine(
  1. AbstractPoint point, {
  2. bool generator = false,
})

Constructs a ProjectiveECCPoint from an AffinePointt in affine coordinates.

The point parameter represents the input affine point. The generator flag specifies whether this point is a generator point.

The resulting projective point has its curve, x, and y values set based on the input affine point, with z set to one. The order is also taken from the input affine point.

Returns a ProjectiveECCPoint in projective coordinates.

Implementation

factory ProjectiveECCPoint.fromAffine(AbstractPoint point,
    {bool generator = false}) {
  if (point is! ProjectiveECCPoint && point is! AffinePointt) {
    throw const ArgumentException("invalid Affine point");
  }
  return ProjectiveECCPoint._(
      point.curve as CurveFp, [point.x, point.y, BigInt.one],
      generator: generator, order: point.order);
}