Question: How can an row Vector be extended

I need to conver 2D points to projective points. Originally I used lists but now need to handle vectors too. To add to that that the projective coordinate for points is now being stated as [1,x,y] instead of [x,y,1]. That is was easy enough to handle for lists.

I have a lot of old worksheets that use the list form [x,y,1] that I want to maintain compatibility with. I only have one procedure I need to convert.
 

Mobposn := 1;
testP := [2, 7];
if Mobposn = 1 then
    [1, op(testP)];
else
    [op(testP), 1];
end if;

I need to do the same for vector definition of the points. The points are defined as row Vectors

A:=<2,7>^%T

to get

Ap:=<1,2,7>^%T

or

Ap:=<2,7,1>^%T

I know coud just do (as these are short vectors)
 

Ap:=<1,A_1,A_2>^%T

or
Ap:=<A_1,A_2,1>^%T

Is there a more general way?

Please Wait...