Question: Text plotting and select from list

I have and input parameter to a procedure called shift:=05. It sets the position of test between to points.

this particular procedure has two potential sets of text one in Q and the other in vec.
Can Q and vec have the own individual values for shift?

I have shown the input to the procedure and what it outputs. The procedure itself to too long and akward to the post.

Also given is the input definiton of the procedure and how I could possibly find a shift in a list.

 

restart

#with( RationalTrigonometry)

P1:=[-1,3]:P2:=[4,5]:

# shift operates as such mp:=P1+shift*(P2-P1). It's default value 0.5 It moves
#   the text along between P1 and P2
# shift and shift are optional inputs to move individual test pieces.
#If Q contains shift then use it else use shift
  qp:=P1+shift*(P2-P1) or qp:=P1+shift*(P2-P1)
#Similarily for vec

Qdim([P1,typeset("P1=",P1),align=[left],colour=red] ,
     [P2,typeset("P2=",P2),align=[right],colour=purple] ,
      Q=[Q_12,align =[below,right],shift=0.6] ,
      point=[symbolsize=12,symbol=solidcircle,colour=blue,shift=0.4] ,
      vec=[typeset("v[12]=",P2-P1),align=[below,right],shift=0.1],
      shift=0.7):  

#The definition input of the procedure is

 

#proc(P1, P2,
#    {Q:=[ NULL,:-align={':-left'}]},
#        {corp::{"cart","proj"}:="cart"},
#        {shift:=0.5},
#        {vec::list:=[]},
#        {scale::{list,integer}:=1},
#        {leader::{-1,0,1}:= 1},
#        {dimoffset::{1/6,1/5,1/4,3/4,2/3,1/2,1/3,1,3/2,2,3,4,5,6}:=1},
#        {point::list:=['color' = ':-blue', symbol = ':-solidcircle', 'symbolsize' = 8]},
#        {line::list:=['thickness'=3]},
#        {plopts::list:=[]})

restart

Q:=[Q_12,shift=0.6,align =[below,right]]  
      
      

 

[Q_12, shift = .6, align = [below, right]]

(1)

nops(Q)

3

(2)

for i to nops(Q) do
 if has([op(Q[i])],`shift`) then
 qp:=rhs(Q[i]);
 print(i,qp);
 break;
end if;
end do;

2, .6

(3)

 


 

Download 2024-09-18_Select_name_and_Value_from_List.mw

Please Wait...