→ home
 
→ index of namespace default
 
→ index of project core
 
→ index of module core

Class core.FloatArray


Synopsis: An arraylist of 32bit floating point values.

  Base classes:
  Derived classes:
  Methods: See also:  


Method add
Add the given float value to this array.
Signature
add(floatf)
 :boolean
Arguments
floatf–Float value to add
Returns
boolean–true if the value has been added successfully, false otherwise.
Description

Resize array if necessary.
See also:  


 
→ top of page
Method addArray
Add the given array like object to this array.
Signature
addArray(Objectarray,
  intoff,
  intlen 
  )  
 :boolean
Arguments
Objectarray–Array-like object
intoff–Source offset
intlen–Number of elements
Returns
boolean–true if the array has been added successfully, false otherwise.
Description

Resize array if necessary.
See also:  


 
→ top of page
Method addEmpty
Increase the number of used elements.
Signature
addEmpty(intnum)
 :int
Arguments
intnum–Number of elements to add
Returns
int–New number of elements
Description

This will not resize the array!
See also:  


 
→ top of page
Method alloc
Allocate the given number of array elements.
Signature
alloc(intmax)
 :boolean
Arguments
intmax–New total number of elements
Returns
boolean–true if the allocation succeeded, false otherwise.
Description

The number of used elements, numElements, will be reset to 0.
See also:  


 
→ top of page
Method bezierCubicDeCasteljau2d
Calculate bezier curve using the de Casteljau algorithm.
Signature
bezierCubicDeCasteljau2d(floatx0,
  floaty0,
  floatx1,
  floaty1,
  floatx2,
  floaty2,
  floatx3,
  floaty3,
  floatscaleX,
  floatscaleY,
  intrecMax,
  floatthresholdB,
  floatthresholdP,
  FloatArrayretT 
  )  
Arguments
floatx0–Start point x
floaty0–Start point y
floatx1–Control point #1 x
floaty1–Control point #1 y
floatx2–Control point #2 x
floaty2–Control point #2 y
floatx3–End point x
floaty3–End point y
floatscaleX–x scaling factor
floatscaleY–y scaling factor
intrecMax–recursion limit
floatthresholdB–bendiness threshold (max distance between bezier midpoint and plane (p3-p0 and perpendicular normal)
floatthresholdP–position threshold (max distance between start and end point)
FloatArrayretT–
Description

Note: the array will first be emptied and then filled with the resulting vertices (check numElements afterwards).

 
→ top of page
Method blend
Blend with other array and write to this array.
Signature
blend(FloatArrayb,
  floatweight 
  )  
Arguments
FloatArrayb–Other array
floatweight–Scale factor for deltas. Range is 0..1
Description

Scale delta (otherValue-thisValue) by "weight" and write to this array.
See also:  


 
→ top of page
Method blendAB
Blend two arrays and write to this array.
Signature
blendAB(FloatArraya,
  FloatArrayb,
  floatweight 
  )  
Arguments
FloatArraya–First array
FloatArrayb–Second array
floatweight–Blend factor. Range is 0..1
Description

Scale delta (bValue-aValue) by "weight" and write to this array.
See also:  


 
→ top of page
Method contains
Check whether array contains the given value.
Signature
contains(floatf)
 :boolean
Arguments
floatf–Element value to look for
Returns
boolean–true if an element with value "f" was found, false otherwise.

 
→ top of page
Method copyFrom
Copy elements from source array.
Signature
copyFrom(FloatArraysrc,
  intoff,
  intlen,
  intdestOff 
  )  
Arguments
FloatArraysrc–
intoff–Source offset in source array
intlen–Number of elements to copy
intdestOff–Destination offset in this array

 
→ top of page
Method delete
Delete element at the given index.
Signature
delete(intindex)
 :boolean
Arguments
intindex–Which element to delete
Returns
boolean–true if the element was deleted, false otherwise.
See also:  


 
→ top of page
Method empty
Reset the number of used elements, numElements, to 0.
Signature
empty()
See also:  


 
→ top of page
Method fill
Set all used elements to the given value.
Signature
fill(floatf)
Arguments
floatf–Fill value

 
→ top of page
Method findNearestIdx1d
Find index of x-element that has the smallest distance to point x.
Signature
findNearestIdx1d(floatx,
  intoff,
  intstride,
  floatmaxDist 
  )  
 :int
Arguments
floatx–Point x
intoff–Element start offset
intstride–Element advance (must be >0)
floatmaxDist–Maximum distance
Returns
int–Index of element or -1 if the point is too far away

 
→ top of page
Method findNearestIdx2d
Treat elements as x/y 2d vectors and find index of x-element that has the smallest distance to point (x,y).
Signature
findNearestIdx2d(floatx,
  floaty,
  intoff,
  intstride,
  floatmaxDist,
  floataspect 
  )  
 :int
Arguments
floatx–Point x
floaty–Point y
intoff–Element start offset
intstride–Element advance (must be >0)
floatmaxDist–Maximum distance
floataspect–Aspect ratio (width/height) of graphical representation
Returns
int–Index of element (x-component of 2d vector) or -1 if the point is too far away

 
→ top of page
Method free
Free all array elements.
Signature
free()

 
→ top of page
Method get
Return element value at the given index.
Signature
get(intindex)
 :float
Arguments
intindex–Which element to return
Returns
float–Element value
Description

Silently return 0.0f if "index" is out of bounds.

 
→ top of page
Method getAbsMax
Return biggest element value, not regarding sign.
Signature
getAbsMax():float
Returns
float–Maximum value
See also:  


 
→ top of page
Method getAbsMean
Return average element value, not regarding sign.
Signature
getAbsMean():float
Returns
float–Average value
See also:  


 
→ top of page
Method getAbsMin
Return smallest element value, not regarding sign.
Signature
getAbsMin():float
Returns
float–Minimum value
See also:  


 
→ top of page
Method getFirst
Return first array element.
Signature
getFirst():float
Returns
float–First array element or 0.0f if the array is empty.

 
→ top of page
Method getLast
Return last used array element.
Signature
getLast():float
Returns
float–Last used array element (numElements - 1) or 0.0f if the array is empty.

 
→ top of page
Method getMax
Return biggest element value.
Signature
getMax():float
Returns
float–Maximum value
See also:  


 
→ top of page
Method getMaxElements
Return total number of elements.
Signature
getMaxElements():int
Returns
int–Total number of elements.
See also:  


 
→ top of page
Method getMean
Return average element value.
Signature
getMean():float
Returns
float–Average value
See also:  


 
→ top of page
Method getMin
Return smallest element value.
Signature
getMin():float
Returns
float–Minimum value
See also:  


 
→ top of page
Method getNumElements
Return number of used elements.
Signature
getNumElements():int
Returns
int–Number of used elements
See also:  


 
→ top of page
Method getString
Return string representation of this array.
Signature
getString():String
Returns
String–new String instance holding a string representation of this array.

 
→ top of page
Method insert
Insert new element before the given index.
Signature
insert(intindex,
  floatf 
  )  
 :boolean
Arguments
intindex–Where to insert the new element
floatf–Value to insert
Returns
boolean–true if the new elements was inserted successfully, false otherwise.
Description

This will resize the array if required.
See also:  


 
→ top of page
Method interleave
Copy interleaved elements from multi-channel array.
Signature
interleave(intnumDestCh,
  intdestCh,
  FloatArraysrc,
  intnumSrcCh,
  intsrcCh,
  intnumCh,
  intnumElem 
  )  
Arguments
intnumDestCh–Number of channels (in this array)
intdestCh–Destination channel index (in this array)
FloatArraysrc–Source buffer
intnumSrcCh–Number of source channels
intsrcCh–Source channel index
intnumCh–Number of channels to copy
intnumElem–Number of elements/frames to copy

 
→ top of page
Method isEqual
Compare to other array and return true if the array contents are equal.
Signature
isEqual(FloatArrayo)
 :boolean
Arguments
FloatArrayo–Other array
Returns
boolean–true if the array contents are equal

 
→ top of page
Method join
Join arrays 'a' and 'b'.
Signature
join(Objecta,
  Objectb 
  )  
Arguments
Objecta–Other array (or this, or null)
Objectb–Other array (or this, or null)

 
→ top of page
Method loadFromStreamFloat32
Read 24bit IEEE floats from stream.
Signature
loadFromStreamFloat32(Streams,
  intnum 
  )  
 :boolean
Arguments
Streams–
intnum–Number of samples to read
Returns
boolean–true if the samples have been loaded successfully

 
→ top of page
Method loadFromStreamSigned16
Read signed 16bit integers from stream, convert to float and normalize.
Signature
loadFromStreamSigned16(Streams,
  intnum 
  )  
 :boolean
Arguments
Streams–
intnum–Number of samples to read
Returns
boolean–true if the samples have been loaded successfully

 
→ top of page
Method loadFromStreamSigned24
Read signed 24bit integers from stream, convert to float and normalize.
Signature
loadFromStreamSigned24(Streams,
  intnum 
  )  
 :boolean
Arguments
Streams–
intnum–Number of samples to read
Returns
boolean–true if the samples have been loaded successfully

 
→ top of page
Method loadFromStreamUnsigned8
Read unsigned 8bit integers from stream, convert to float and normalize.
Signature
loadFromStreamUnsigned8(Streams,
  intnum 
  )  
 :boolean
Arguments
Streams–
intnum–Number of samples to read
Returns
boolean–true if the samples have been loaded successfully

 
→ top of page
Method read32
Read 32bit floating point values from the given input stream.
Signature
read32(Streamifs,
  intnum,
  intdestOff 
  )  
 :int
Arguments
Streamifs–Input stream
intnum–Number of elements to read
intdestOff–Destination offset in this array
Returns
int–Number of elements read

 
→ top of page
Method read64
Read 64bit floating point values from the given input stream and truncate to 32bit.
Signature
read64(Streamifs,
  intnum,
  intdestOff 
  )  
 :int
Arguments
Streamifs–Input stream
intnum–Number of elements to read
intdestOff–Destination offset in this array
Returns
int–Number of elements read

 
→ top of page
Method realloc
Reallocate array to given size.
Signature
realloc(intmax)
 :boolean
Arguments
intmax–New total number of elements
Returns
boolean–true if the reallocation succeeded, false otherwise.
Description

Discard/add new elements as required.
See also:  


 
→ top of page
Method rearrange
Rearrange array elements according to the given IntArray.
Signature
rearrange(IntArrayorder)
 :boolean
Arguments
IntArrayorder–Holds the new element array
Returns
boolean–true if the elements have been re-arranged successfully, false otherwise.

 
→ top of page
Method reverse
Reverse element order
Signature
reverse()

 
→ top of page
Method scale
Read elements from source array, scale by s and write to this array.
Signature
scale(FloatArraysrc,
  floats 
  )  
Arguments
FloatArraysrc–
floats–Scale factor
Description

@todo Use operator =>

 
→ top of page
Method setNumElements
Set the number of used elements to the given value.
Signature
setNumElements(intnum)
Arguments
intnum–New number of used elements
See also:  


 
→ top of page
Method sortByValue
Sort elements by value and write new element order to the given IntArray.
Signature
sortByValue(IntArrayorder)
Arguments
IntArrayorder–Receives the new element order

 
→ top of page
Method sum
Sum elements
Signature
sum(intoff,
  intnum 
  )  
 :float
Arguments
intoff–Index of first element
intnum–Number of elements to sum
Returns
float–Sum

 
→ top of page
Method sumPathLen1d
Sum element deltas
Signature
sumPathLen1d(intoff,
  intnum 
  )  
 :float
Arguments
intoff–Index of first element
intnum–Number of elements to sum
Returns
float–Path length

 
→ top of page
Method sumPathLen2d
Treat elements as x/y 2d vectors and calculate path length.
Signature
sumPathLen2d(intoff,
  intnum 
  )  
 :float
Arguments
intoff–Index of first vector (float element offset / 2)
intnum–Number of vectors to sum (number of float elements / 2)
Returns
float–Path length

 
→ top of page
Method swap
Swap two array elements.
Signature
swap(intindexA,
  intindexB 
  )  
 :boolean
Arguments
intindexA–Index of first element
intindexB–Index of second element
Returns
boolean–true if the elements have been swapped successfully, false otherwise.

 
→ top of page
Method useAll
Mark all array elements used, i.e. set numElements = maxElements.
Signature
useAll()

 
→ top of page
Method visit
Create a view into the given FloatArray.
Signature
visit(FloatArraysrc,
  intoff,
  intlen 
  )  
Arguments
FloatArraysrc–Source array
intoff–Source offset
intlen–Number of elements

 
→ top of page
Method winCosine
Return cosine interpolation of elements.
Signature
winCosine(floatindex)
 :float
Arguments
floatindex–Element index
Returns
float–Interpolated value
See also:  


 
→ top of page
Method winCubic
Return cubic interpolation of elements.
Signature
winCubic(floatindex)
 :float
Arguments
floatindex–Element index
Returns
float–Interpolated value
See also:  


 
→ top of page
Method winLinear
Return linear interpolation of elements.
Signature
winLinear(floatindex)
 :float
Arguments
floatindex–Element index
Returns
float–Interpolated value
See also:  


 
→ top of page
Method winQuadratic
Return quadratic interpolation of elements.
Signature
winQuadratic(floatindex)
 :float
Arguments
floatindex–Element index
Returns
float–Interpolated value
See also:  


 
→ top of page
Method winQuintic
Return quintic interpolation of elements.
Signature
winQuintic(floatindex)
 :float
Arguments
floatindex–Element index
Returns
float–Interpolated value
See also:  


 
→ top of page
Method write32
Write 32bit floating point values to the given output stream.
Signature
write32(Streamofs,
  intnum,
  intsrcOff 
  )  
 :int
Arguments
Streamofs–Output stream
intnum–Number of elements to write
intsrcOff–Source offset in this array
Returns
int–Number of elements written

 
→ top of page
Method write64
Write 64bit floating point values to the given output stream.
Signature
write64(Streamofs,
  intnum,
  intsrcOff 
  )  
 :int
Arguments
Streamofs–Output stream
intnum–Number of elements to write
intsrcOff–Source offset in this array
Returns
int–Number of elements written

 
→ top of page
 

Project Modules:core 
Project Classes:Boolean , Buffer , Byte , Class , ClassArray , Condition , Configuration , Double , DummyStream , Envelope , Event , Exception , File , Float , FloatArray , FloatArray128 , FloatArray16 , FloatArray32 , FloatArray64 , FloatArray8 , Function , HashTable , IntArray , IntArray128 , IntArray16 , IntArray32 , IntArray64 , IntArray8 , Integer , List , ListNode , Long , Mailbox , Mutex , Object , ObjectArray , PakFile , PointerArray , Pool , Script , SharedBuffer , Short , Stack , StdErrStream , StdInStream , StdOutStream , Stream , String , String128 , String16 , String32 , String64 , String8 , StringArray , StringIterator , Thread , Time , TKS , TreeNode , UnsignedByte , UnsignedInteger , UnsignedLong , UnsignedShort , Value , ValueArray , Variable 
Project Functions:ceil , exit , floor , GetCurrentThread , getenv , lcchar , mathAbsMaxf , mathAbsMinf , mathAbsMini , mathAbsMini , mathClampf , mathClampi , mathDistancePointPlane2d , mathLerpf , mathMaxf , mathMaxi , mathMinf , mathMini , mathPowerf , mathPoweri , mathSmoothStepf , mathWrapf , mathWrapi , milliSeconds , psystem , putenv , srand , system , ucchar 
All Namespaces:default , ui 
All Projects:core , debugtext , tkfreetype2 , tkmath , tkmidi , tkopengl , tkportaudio , tksdl , tkui , tkunit 


auto-generated by "DOG", the TkScript document generator. Mon, 28/Dec/2015 13:15:54