Project

General

Profile

« Previous | Next » 

Revision 350cc2f5

Added by Leszek Koltunski over 7 years ago

Make the WAVE effect 5D (extra parameter 'offset')

View differences:

src/main/java/org/distorted/library/DistortedObject.java
29 29
import org.distorted.library.type.Data2D;
30 30
import org.distorted.library.type.Data3D;
31 31
import org.distorted.library.type.Data4D;
32
import org.distorted.library.type.Data5D;
32 33
import org.distorted.library.type.Static3D;
33 34

  
34 35
///////////////////////////////////////////////////////////////////////////////////////////////////
......
816 817
/**
817 818
 * Directional, sinusoidal wave effect.
818 819
 *
819
 * @param wave   A 4-dimensional data structure describing the wave: first member is the amplitude,
820
 *               second is the wave length, and the next two describe the 'direction' of the wave.
820
 * @param wave   A 5-dimensional data structure describing the wave: first member is the amplitude,
821
 *               second is the wave length, third is the offset (i.e. when offset = PI/2, the sine
822
 *               wave at the center does not start from sin(0), but from sin(PI/2) ) and the next two
823
 *               describe the 'direction' of the wave.
821 824
 *               Wave direction is defined to be a 3D vector of length 1. To define such vectors, we
822 825
 *               need 2 floats: thus the third member is the angle Alpha (in degrees) which the vector
823 826
 *               forms with the XY-plane, and the fourth is the angle Beta (again in degrees) which
......
830 833
 *               but this time it waves in the Y-direction, i.e. cross sections of the surface and the
831 834
 *               YZ-plane with be sine shapes.
832 835
 *               Example3: if Alpha = 0 and Beta = 45, then V=(sqrt(2)/2, -sqrt(2)/2, 0) and the wave
833
 *               is entirely 'horizontal' and moves point (x,y,0) in direction V.
836
 *               is entirely 'horizontal' and moves point (x,y,0) in direction V by whatever is the
837
 *               value if sin at this point.
834 838
 * @param center 2-dimensional Data that, at any given time, returns the Center of the Effect.
835 839
 * @return       ID of the effect added, or -1 if we failed to add one.
836 840
 */
837
  public long wave(Data4D wave, Data2D center)
841
  public long wave(Data5D wave, Data2D center)
838 842
    {
839 843
    return mV.add(EffectNames.WAVE, wave, center, null);
840 844
    }
......
843 847
/**
844 848
 * Directional, sinusoidal wave effect.
845 849
 *
846
 * @param wave   A 4-dimensional data structure describing the wave: first member is the amplitude,
847
 *               second is the wave length, and the next two describe the 'direction' of the wave.
848
 *               Wave direction is defined to be a 3D vector of length 1. To define such vectors, we
849
 *               need 2 floats: thus the third member is the angle Alpha (in degrees) which the vector
850
 *               forms with the XY-plane, and the fourth is the angle Beta (again in degrees) which
851
 *               the projection of the vector to the XY-plane forms with the Y-axis (counterclockwise).
852
 *
853
 *               Example1: if Alpha = 90, Beta = 90, (then V=(0,0,1) ) and the wave acts 'vertically'
854
 *               in the X-direction, i.e. cross-sections of the resulting surface with the XZ-plane
855
 *               will be sine shapes.
856
 *               Example2: if Alpha = 90, Beta = 0, the again V=(0,0,1) and the wave is 'vertical',
857
 *               but this time it waves in the Y-direction, i.e. cross sections of the surface and the
858
 *               YZ-plane with be sine shapes.
859
 *               Example3: if Alpha = 0 and Beta = 45, then V=(sqrt(2)/2, -sqrt(2)/2, 0) and the wave
860
 *               is entirely 'horizontal' and moves point (x,y,0) in direction V.
861
 * @param center 2-dimensional Data that, at any given time, returns the Center of the Effect.
850
 * @param wave   see {@see wave(Data5D,Data2D)}
851
 * @param center see {@see wave(Data5D,Data2D)}
862 852
 * @param region Region that masks the Effect.
863 853
 * @return       ID of the effect added, or -1 if we failed to add one.
864 854
 */
865
  public long wave(Data4D wave, Data2D center, Data4D region)
855
  public long wave(Data5D wave, Data2D center, Data4D region)
866 856
    {
867 857
    return mV.add(EffectNames.WAVE, wave, center, region);
868 858
    }

Also available in: Unified diff