@@ -53,6 +53,9 @@ pub trait CurveVar<C: CurveGroup, ConstraintF: PrimeField>:
5353 + for < ' a > Mul < & ' a EmulatedFpVar < C :: ScalarField , ConstraintF > , Output = Self >
5454 + MulAssign < EmulatedFpVar < C :: ScalarField , ConstraintF > >
5555{
56+ /// The base field of the coordinates.
57+ type BaseFieldVar : FieldVar < C :: BaseField , ConstraintF > ;
58+
5659 /// Returns the constant `F::zero()`. This is the identity
5760 /// of the group.
5861 fn zero ( ) -> Self ;
@@ -68,6 +71,19 @@ pub trait CurveVar<C: CurveGroup, ConstraintF: PrimeField>:
6871 /// This *should not* allocate any variables.
6972 fn constant ( other : C ) -> Self ;
7073
74+ /// Returns the x and y coordinates in Affine representation.
75+ fn affine_xy ( & self ) -> Result < ( Self :: BaseFieldVar , Self :: BaseFieldVar ) , SynthesisError > ;
76+
77+ /// Returns the x coordinate in Affine representation.
78+ fn affine_x ( & self ) -> Result < Self :: BaseFieldVar , SynthesisError > {
79+ self . affine_xy ( ) . map ( |( x, _) | x)
80+ }
81+
82+ /// Returns the y coordinate in Affine representation.
83+ fn affine_y ( & self ) -> Result < Self :: BaseFieldVar , SynthesisError > {
84+ self . affine_xy ( ) . map ( |( _, y) | y)
85+ }
86+
7187 /// Allocates a variable in the subgroup without checking if it's in the
7288 /// prime-order subgroup.
7389 fn new_variable_omit_prime_order_check (
0 commit comments