DrawHills
Class SingleHill

java.lang.Object
  extended by DrawHills.SingleHill
Direct Known Subclasses:
Terrain

public class SingleHill
extends java.lang.Object


 This is a basic super class for all 3D-paint procedures.


Field Summary
protected  int altitudeCos
          Values not used when |angle| < .01
protected  int altitudeSin
          Values not used when |angle| < .01
protected  int aziRotationShift
           
 java.awt.Color BackgroundColor
           
protected  int center_x
           
protected  int center_y
           
protected  int CosRotationAngle
           
protected  int CurrFactor
           
protected  int CurrScreenX
           
protected  int CurrScreenY
           
protected  boolean debug
          Set this for debug mode
protected  boolean displayAxes
          Labels: Axis, ...
protected  int firstMeshDrawIx
           
static boolean flagTrianglesVsSquares
           
protected  int frameNumber
          Analog of hills internal time: Number of calls to hill: Can be used if external synch is not supplied.
static int funFlippedParabola
           
static int funGaussBell
           
static int funLowSphere
           
 int funN
           
static int funPolinomials
           
static int funTerrain
          Functions templates: There are two ways to use functions.
static int funUpperSphere
           
static int funY2mX2
           
protected  java.awt.Graphics g
           
protected  java.awt.Color hillAxisColor
           
protected  int hOOx
          hOO - Pos in Observer basis respectively to Obs.
protected  int hOOy
          hOO - Pos in Observer basis respectively to Obs.
protected  int hOOz
          hOO - Pos in Observer basis respectively to Obs.
protected  int lastMeshDrawIx
           
protected  int lightX
           
protected  int lightY
           
protected  int lightZ
           
protected  int MoonHalfPeriod
           
protected  int MoonHorizontalRadius
           
protected  int MoonXStart
           
protected  int MoonZ
           
protected  int[] n2X
           
protected  int[] n2Y
           
protected  int[] n2Z
           
protected  int[] nX
           
protected  int[] nY
           
protected  int[] nZ
           
protected  double oAltitudeViewAngle
           
protected  int obsX
          obs - Pos of Obs in Flat Valley.
protected  int obsY
          obs - Pos of Obs in Flat Valley.
protected  int obsZ
          obs - Pos of Obs in Flat Valley.
 java.awt.Color OwnColor
           
protected  int phase_sig
           
protected  int phase_sub
           
protected  int posX
           pos - Pos of Hill in Flat Valley.
protected  int posY
           pos - Pos of Hill in Flat Valley.
protected  int posZ
           pos - Pos of Hill in Flat Valley.
protected  int radius
           
protected  int[][] Real_current
           
protected  int[][] Real_previous
           
protected  int ReservedDomain
          Remember: Xsize * Yrange < ReservedDomain
protected  int REventX
           
protected  int REventY
           
protected  int RotatedYAuxilairy
           
protected  int RotationModula
           
protected  int safeModule
           
protected  int safeScale
           
protected  int[][] screen_current
           
protected  int[][] screen_upper
           
protected  int[][] screenMesh2X
          This is a mesh: "patches" on function's surface: See triangles ABC and ACD below in ContructHill method.
protected  int[][] screenMesh2Z
          For second triangle.
protected  int[][] screenMeshX
           
protected  int[][] screenMeshZ
           
protected  int ScreenXL
           
protected  int ScreenYL
           
protected  double shieldRadius
           
protected  int SinRotationAngle
           
protected  SPad sp
          Labels: Text area ...
protected  SPad spOwn
          Labels: Text area ...
protected  int tangentOfVision
           
protected  int Xmax
           
protected  int Xmin
           
protected  int Xsize
           
protected  int Xstep
           
protected  int Ymax
           
 int YMaxMin
           
protected  int Ymin
           
protected  int Yrange
           
protected  int Ystep
           
 
Constructor Summary
SingleHill()
           
SingleHill(SPad sp, SPad spOwn, int ScreenXL, int ScreenYL, int center_x, int center_y, int funN)
           
 
Method Summary
protected  void ConstructHill()
           
protected  void DisplayMoon()
           
protected  void DrawAxisToHill()
           
protected  void DrawCoordinateAxis()
           
 void DrawLegendedLine(int X1, int Y1, int Z1, int X2, int Y2, int Z2, java.awt.Color c, java.lang.String LTitle)
           
 void DrawLegendedLine(int X1, int Y1, int Z1, int X2, int Y2, int Z2, int Col1, int Col2, int Col3, java.lang.String LTitle)
           
protected  void FindMoonPhase(int HalfPeriod)
           
 int FindScreenX(int X, int Y, int Z)
           
 int FindScreenY(int X, int Y, int Z)
           
 int Fun(int funNumb, int X, int Y)
           
 void InsertSubHill(int iii, int frontDistance)
          Just a template for children classes.
 void ms(java.lang.String s)
           
 int ObsToSX(int X, int Y, int Z)
           
protected  void PaintAuxSigns()
           
protected  void PaintFunction()
           
 void paintHill(int obsX, int obsY, int obsZ, double obsY1, double obsY2, double obsY3, int ExternalFrameNumber, boolean fillScrBackgroundBeforeDraw, boolean dispalyMoon, boolean displayAxes, double oAltitudeViewAngle)
           This is main interface to paint procedures, main gate.
protected  void paintHillInternally(boolean recalculate_function, boolean fillScrBackgroundBeforeDraw, boolean dispalyMoon, boolean displayAxes)
           
protected  void PositionMoon()
           
 void ProjectObsSpaceLineToS(int X1, int Y1, int Z1, int X2, int Y2, int Z2, java.awt.Color c, java.lang.String LTitle)
           
 void ProjectObsSpaceLineToScr(int X1, int Y1, int Z1, int X2, int Y2, int Z2, int Col1, int Col2, int Col3, java.lang.String LTitle)
           
 void releaseGraphics()
           
 int root(int t)
           
 int RotateArgToFunctDomainBasisX(int X, int Y)
           
 void supplyGraphics()
          Make sure that this is executed after contructor after own Scratch Pad Graphics is supplied.
 int XRotated(int X, int Y)
           
 int YRotated()
           
 int YRotatedBack()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flagTrianglesVsSquares

public static boolean flagTrianglesVsSquares

debug

protected boolean debug
Set this for debug mode


displayAxes

protected boolean displayAxes
Labels: Axis, ...


safeModule

protected int safeModule

safeScale

protected int safeScale

tangentOfVision

protected int tangentOfVision

posX

protected int posX
 pos - Pos of Hill in Flat Valley. Iww, in Flat Local Scene.
 They are set at function definition.
 They are not used in internal paint procedures.
 They are used only to define hOO.


posY

protected int posY
 pos - Pos of Hill in Flat Valley. Iww, in Flat Local Scene.
 They are set at function definition.
 They are not used in internal paint procedures.
 They are used only to define hOO.


posZ

protected int posZ
 pos - Pos of Hill in Flat Valley. Iww, in Flat Local Scene.
 They are set at function definition.
 They are not used in internal paint procedures.
 They are used only to define hOO.


obsX

protected int obsX
obs - Pos of Obs in Flat Valley. Supplied in PaintHill proc.


obsY

protected int obsY
obs - Pos of Obs in Flat Valley. Supplied in PaintHill proc.


obsZ

protected int obsZ
obs - Pos of Obs in Flat Valley. Supplied in PaintHill proc.


hOOx

protected int hOOx
hOO - Pos in Observer basis respectively to Obs.


hOOy

protected int hOOy
hOO - Pos in Observer basis respectively to Obs.


hOOz

protected int hOOz
hOO - Pos in Observer basis respectively to Obs.


altitudeCos

protected int altitudeCos
Values not used when |angle| < .01


altitudeSin

protected int altitudeSin
Values not used when |angle| < .01


oAltitudeViewAngle

protected double oAltitudeViewAngle

funTerrain

public static final int funTerrain
Functions templates: There are two ways to use functions. Supply this funN for this constants for predefined functions. Or, override Fun method when deriving a class.

See Also:
Constant Field Values

funFlippedParabola

public static final int funFlippedParabola
See Also:
Constant Field Values

funY2mX2

public static final int funY2mX2
See Also:
Constant Field Values

funGaussBell

public static final int funGaussBell
See Also:
Constant Field Values

funPolinomials

public static final int funPolinomials
See Also:
Constant Field Values

funUpperSphere

public static final int funUpperSphere
See Also:
Constant Field Values

funLowSphere

public static final int funLowSphere
See Also:
Constant Field Values

funN

public int funN

shieldRadius

protected double shieldRadius

Xmin

protected int Xmin

Xmax

protected int Xmax

Xstep

protected int Xstep

Ymin

protected int Ymin

Ymax

protected int Ymax

Ystep

protected int Ystep

YMaxMin

public int YMaxMin

aziRotationShift

protected int aziRotationShift

RotationModula

protected int RotationModula

SinRotationAngle

protected int SinRotationAngle

CosRotationAngle

protected int CosRotationAngle

RotatedYAuxilairy

protected int RotatedYAuxilairy

center_x

protected int center_x

center_y

protected int center_y

ScreenXL

protected int ScreenXL

ScreenYL

protected int ScreenYL

CurrScreenX

protected int CurrScreenX

CurrScreenY

protected int CurrScreenY

CurrFactor

protected int CurrFactor

ReservedDomain

protected int ReservedDomain
Remember: Xsize * Yrange < ReservedDomain


Xsize

protected int Xsize

Yrange

protected int Yrange

firstMeshDrawIx

protected int firstMeshDrawIx

lastMeshDrawIx

protected int lastMeshDrawIx

screenMeshX

protected int[][] screenMeshX

screenMeshZ

protected int[][] screenMeshZ

screenMesh2X

protected int[][] screenMesh2X
This is a mesh: "patches" on function's surface: See triangles ABC and ACD below in ContructHill method. screenMesh2X - for second triangle.


screenMesh2Z

protected int[][] screenMesh2Z
For second triangle.


nX

protected int[] nX

nY

protected int[] nY

nZ

protected int[] nZ

n2X

protected int[] n2X

n2Y

protected int[] n2Y

n2Z

protected int[] n2Z

screen_current

protected int[][] screen_current

Real_current

protected int[][] Real_current

Real_previous

protected int[][] Real_previous

screen_upper

protected int[][] screen_upper

BackgroundColor

public java.awt.Color BackgroundColor

OwnColor

public java.awt.Color OwnColor

hillAxisColor

protected java.awt.Color hillAxisColor

phase_sub

protected int phase_sub

phase_sig

protected int phase_sig

MoonZ

protected int MoonZ

MoonHorizontalRadius

protected int MoonHorizontalRadius

MoonHalfPeriod

protected int MoonHalfPeriod

MoonXStart

protected int MoonXStart

lightZ

protected int lightZ

lightY

protected int lightY

lightX

protected int lightX

REventX

protected int REventX

REventY

protected int REventY

radius

protected int radius

g

protected java.awt.Graphics g

sp

protected SPad sp
Labels: Text area ... spOwn is coinsided with own graphics screen.


spOwn

protected SPad spOwn
Labels: Text area ... spOwn is coinsided with own graphics screen.


frameNumber

protected int frameNumber
Analog of hills internal time: Number of calls to hill: Can be used if external synch is not supplied.

Constructor Detail

SingleHill

public SingleHill()

SingleHill

public SingleHill(SPad sp,
                  SPad spOwn,
                  int ScreenXL,
                  int ScreenYL,
                  int center_x,
                  int center_y,
                  int funN)
Method Detail

supplyGraphics

public void supplyGraphics()
Make sure that this is executed after contructor after own Scratch Pad Graphics is supplied.


releaseGraphics

public void releaseGraphics()

paintHill

public void paintHill(int obsX,
                      int obsY,
                      int obsZ,
                      double obsY1,
                      double obsY2,
                      double obsY3,
                      int ExternalFrameNumber,
                      boolean fillScrBackgroundBeforeDraw,
                      boolean dispalyMoon,
                      boolean displayAxes,
                      double oAltitudeViewAngle)
 This is main interface to paint procedures, main gate.

Parameters:
obsX - Observer's X-position in Flat Valley.
ExternalFrameNumber - synchronize with external state frame number if < 0 then internal frame numeration is used.
obsY1 - projection of n on axis X = Cos(FI)
obsY2 - projection of n on axis Y = Sin(FI)
obsY3 - projection of n on axis Z = Cos(PSY) - not used If observer turns the head clockwise, then FI > 0 The Hill turns couterclockwise, so x'=xCos(FI)-ySin(FI) Here: obsY1=nx=Cos(FI), ny=obsY2=Sin(FI), nz=obsY3=Cos(PSY). vector n=observer's direction after observer's turn. (Note: if to measure obs turn respect to axis X, FI|X, then FI|Y = FI|X - PI/2.)
fillScrBackgroundBeforeDraw -

paintHillInternally

protected void paintHillInternally(boolean recalculate_function,
                                   boolean fillScrBackgroundBeforeDraw,
                                   boolean dispalyMoon,
                                   boolean displayAxes)

ConstructHill

protected void ConstructHill()

PaintFunction

protected void PaintFunction()

DrawCoordinateAxis

protected void DrawCoordinateAxis()

DrawAxisToHill

protected void DrawAxisToHill()

ProjectObsSpaceLineToScr

public void ProjectObsSpaceLineToScr(int X1,
                                     int Y1,
                                     int Z1,
                                     int X2,
                                     int Y2,
                                     int Z2,
                                     int Col1,
                                     int Col2,
                                     int Col3,
                                     java.lang.String LTitle)

ProjectObsSpaceLineToS

public void ProjectObsSpaceLineToS(int X1,
                                   int Y1,
                                   int Z1,
                                   int X2,
                                   int Y2,
                                   int Z2,
                                   java.awt.Color c,
                                   java.lang.String LTitle)

DrawLegendedLine

public void DrawLegendedLine(int X1,
                             int Y1,
                             int Z1,
                             int X2,
                             int Y2,
                             int Z2,
                             int Col1,
                             int Col2,
                             int Col3,
                             java.lang.String LTitle)

DrawLegendedLine

public void DrawLegendedLine(int X1,
                             int Y1,
                             int Z1,
                             int X2,
                             int Y2,
                             int Z2,
                             java.awt.Color c,
                             java.lang.String LTitle)

XRotated

public int XRotated(int X,
                    int Y)

YRotated

public int YRotated()

RotateArgToFunctDomainBasisX

public int RotateArgToFunctDomainBasisX(int X,
                                        int Y)

YRotatedBack

public int YRotatedBack()

FindScreenX

public int FindScreenX(int X,
                       int Y,
                       int Z)

FindScreenY

public int FindScreenY(int X,
                       int Y,
                       int Z)

ObsToSX

public int ObsToSX(int X,
                   int Y,
                   int Z)

FindMoonPhase

protected void FindMoonPhase(int HalfPeriod)

PositionMoon

protected void PositionMoon()

DisplayMoon

protected void DisplayMoon()

ms

public void ms(java.lang.String s)

PaintAuxSigns

protected void PaintAuxSigns()

Fun

public int Fun(int funNumb,
               int X,
               int Y)

root

public int root(int t)

InsertSubHill

public void InsertSubHill(int iii,
                          int frontDistance)
Just a template for children classes. Can be overriden.