Extends the Vector class with support for sine wave based paths.
The VectorWave class provides functionality for generating paths based on sine waves. This feature is not part of the SVG standard and therefore should not be used in cases where SVG compliance is a strict requirement.
The sine wave will be generated from (X,Y) across Length. The parent view height provides the vertical region for centring and path closure, while Amplitude defines the wave height. The path vertices are generated on a left-to-right basis.
Waves can be used in Kotuku's SVG implementation by using the <kotuku:wave/> element.
The VectorWave class consists of the following fields:
Access | Name | Type | Comment | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Amplitude | UNIT | Defines the generated wave height. | |||||||||||
The Amplitude is expressed as a fixed or scaled value. Fixed values are used directly, while scaled values are resolved against the parent view height. | |||||||||||||
| Close | WVC | Closes the generated wave path at either the top or bottom. | |||||||||||
Setting the Close field to
| |||||||||||||
| Decay | DOUBLE | Declares a rate of decay to apply to the wave amplitude. | |||||||||||
The amplitude of a wave can be decayed between its start and end points by setting the Decay field. A value of | |||||||||||||
| Envelope | WVE | Selects the interpolation envelope applied to the wave. | |||||||||||
The Envelope field controls how the Decay value, and any FrequencyEnd sweep, is interpolated across the wave. The default
| |||||||||||||
| Frequency | DOUBLE | Defines the wave frequency at the start of the wave. | |||||||||||
The frequency determines the distance between each individual wave that is generated. The default value for the frequency is 1.0. Shortening the frequency to a value closer to 0 will bring the waves closer together. If FrequencyEnd is set to a different value, Frequency is used as the start frequency for the sweep. | |||||||||||||
| FrequencyEnd | DOUBLE | Defines the wave frequency at the end of the wave. | |||||||||||
When FrequencyEnd differs from Frequency, the wave performs a frequency sweep between the start and end points. The frequency is interpolated across the wave using the selected Envelope, and the phase is integrated from that interpolated frequency so the result behaves as a chirp. If FrequencyEnd is not assigned, it follows Frequency and the wave uses a constant frequency. | |||||||||||||
| Length | UNIT | The horizontal length of the generated wave. | |||||||||||
The length of the generated wave is defined here as a fixed or scaled value. | |||||||||||||
| Noise | DOUBLE | Perturbs the generated wave path with deterministic noise. | |||||||||||
The Noise value ranges from | |||||||||||||
| Phase | DOUBLE | Declares the initial phase, in degrees, to use when generating the wave. | |||||||||||
The phase value defines the initial position that is used when computing the wave. The default is zero. Visually, changing the phase will affect the 'offset' of the generated wave. Gradually incrementing the value will give the wave an appearance of moving from right to left. | |||||||||||||
| Thickness | UNIT | Expands the diameter of the wave to the specified value to produce a closed path. | |||||||||||
Specifying a thickness value will create a wave that forms a filled shape, rather than the default of a stroked path. The thickness (diameter) of the wave is determined by the provided value. If defined as a percentage, the value is resolved against the normalised diagonal of the parent viewport, matching the scaling rule used for Vector⇒StrokeWidth. Thickness is not compatible with the Close option, and takes precedence over it. | |||||||||||||
| Type | WVT | Selects an alternative wave style. | |||||||||||
By default, waves are generated in the style of a sine wave. Alternative styles can be selected by setting this field. The
| |||||||||||||
| X | UNIT | The x coordinate of the wave. Can be expressed as a fixed or scaled coordinate. | |||||||||||
The x coordinate of the wave is defined here as either a fixed or scaled value. | |||||||||||||
| Y | UNIT | The y coordinate of the wave. Can be expressed as a fixed or scaled coordinate. | |||||||||||
The y coordinate of the wave is defined here as either a fixed or scaled value. | |||||||||||||
The following actions are currently supported:
| Move | Moves the vector to a new position. | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
ERR acMove(*Object, DOUBLE DeltaX, DOUBLE DeltaY, DOUBLE DeltaZ)
| ||||||||||||
| MoveToPoint | Moves the vector to a new fixed position. | |||||||||||
ERR acMoveToPoint(*Object, DOUBLE X, DOUBLE Y, DOUBLE Z, MTF Flags)
| ||||||||||||
| Resize | Changes the vector's length and amplitude. | |||||||||||
ERR acResize(*Object, DOUBLE Width, DOUBLE Height, DOUBLE Depth)
| ||||||||||||
Wave options.
| Name | Description |
|---|---|
| WVC::BOTTOM | Close the path across the bottom of its area. |
| WVC::TOP | Close the path across the top of its area. |
Wave envelope options.
| Name | Description |
|---|---|
| WVE::EXPONENTIAL | Exponential decay, weighted strongly towards the start of the wave. |
| WVE::LINEAR | Linear decay from start to end, this is the default. |
| WVE::QUADRATIC | Quadratic decay, weighted towards the end of the wave. |
| WVE::SMOOTHSTEP | Smoothstep decay with ease-in and ease-out. |
Wave style options.
| Name | Description |
|---|---|
| WVT::SAWTOOTH | Sawtooth patterns rise at 45 degrees to the peak, then direct 90 degrees to the bottom. |
| WVT::SINE | Standard sine-wave curvature, this is the default. |
| WVT::SQUARE | Stepped pattern that alternates between the peak and bottom edge with vertical transitions. |
| WVT::TRIANGLE | Chevron style angles at 45 degrees either side of the peak and bottom edge. |