Python vs Modula-2

(9) Which is South?

To Workbench Python (EN)    

<Task>

Detective Conan says to himself, "Which is the south? I know the position of the Sun and I have a watch." He aligns the hour hand to the Sun and finds a bisector between it and 12 o'clock mark. Please see the Manga "Detective Conan", vol. 16 (1997).

The position of the sun, P(ƒÕ,ƒÓ), has already been obtained. Here we add time information to the plots.

<Position of the Sun >

At two o'clock the south is toward a bisector of the hour hand and 12, which Detector Conan claims.

Added code
<Python>

Code added to class getPsiPhi

    onClockPsi = np.zeros((NjustH+1,Nphis))
    onClockPhi = np.zeros((NjustH+1,Nphis))    
    Nclock  = np.arange(NjustH+1,dtype='i')
    for ji in range(NjustH):
        Nclock[ji] = 0 
    while(True):
        for j in range(Nphis):
            if j % justHdiv == 0:
                ji = j // justHdiv
                if (ji<2*NjustH):
                    onClockPsi[ji,ii] = psd
                    onClockPhi[ji,ii] = phd
                    Nclock[ji] += 1 

Plotting code

def plotClockHr(Nclock):
    for j in range(NjustH):
        x = []
        y = []
        m=Nclock[j]
        if isHalf:
            m = m // 2
        print("j=",j,"Nclock=",m)
        for k in range(m):
            if onClockPhi[j,k]>0:
                x.append(onClockPsi[j,k])
                y.append(onClockPhi[j,k])
    
        if isHalf:
            plt.plot(x, y, color="black", lw=1)
        else:
            plt.plot(x, y, color="blue",lw=1)
<XDS Modula-2>

Code added to day-scan loop

    LOOP      (* to scan days *)
	    IF (j MOD justHdiv = 0) THEN
	      ji:= j DIV justHdiv;
	      onClock[ji,ii].psid:= psid;
	      onClock[ji,ii].phid:= phid;
	      INC(Nclock[ji]);
	      (*INC(ji);*)
	    END;

Plotting code

 PROCEDURE plotClock();
  CONST
    Size2 = 3;
  VAR
    j,k,n: INTEGER;
  BEGIN
    FOR j:=0 TO 23 DO
      IF isFullclkset THEN n:= Nclock[j]; ELSE n:= Nclock[j] DIV 2; END;
      FOR k:=0 TO n-1 DO
        X[k]:= onClock[j,k].psid;
        Y[k]:= onClock[j,k].phid;
      END;
      IF isOnlyMk THEN
        polylinelong(X, Y, n, 0, 3, Size2, -1, 0);
      ELSE	
        sepPolyline(X, Y, n, 0, dotseparn);
      END;	
    END;
  END plotClock;
Result
<Python>

<Modula-2>

Edited using CorelDraw. Open circles denote the direction of bisector. Taken from a web page in Japanese.

3-12-2025, S. Hayashi