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

Class core.FloatArray


SynopsisAn 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
floatfFloat value to add
Returns
booleantrue 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
ObjectarrayArray-like object
intoffSource offset
intlenNumber of elements
Returns
booleantrue 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
intnumNumber of elements to add
Returns
intNew 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
intmaxNew total number of elements
Returns
booleantrue 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
floatx0Start point x
floaty0Start point y
floatx1Control point #1 x
floaty1Control point #1 y
floatx2Control point #2 x
floaty2Control point #2 y
floatx3End point x
floaty3End point y
floatscaleXx scaling factor
floatscaleYy scaling factor
intrecMaxrecursion limit
floatthresholdBbendiness threshold (max distance between bezier midpoint and plane (p3-p0 and perpendicular normal)
floatthresholdPposition 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
FloatArraybOther array
floatweightScale 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
FloatArrayaFirst array
FloatArraybSecond array
floatweightBlend 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
floatfElement value to look for
Returns
booleantrue 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
intoffSource offset in source array
intlenNumber of elements to copy
intdestOffDestination offset in this array

 
 top of page
Method delete
Delete element at the given index.
Signature
delete(intindex)
 :boolean
Arguments
intindexWhich element to delete
Returns
booleantrue 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
floatfFill 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
floatxPoint x
intoffElement start offset
intstrideElement advance (must be >0)
floatmaxDistMaximum distance
Returns
intIndex 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
floatxPoint x
floatyPoint y
intoffElement start offset
intstrideElement advance (must be >0)
floatmaxDistMaximum distance
floataspectAspect ratio (width/height) of graphical representation
Returns
intIndex 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
intindexWhich element to return
Returns
floatElement 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
floatMaximum value
See also:  


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


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


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

 
 top of page
Method getLast
Return last used array element.
Signature
getLast():float
Returns
floatLast 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
floatMaximum value
See also:  


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


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


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


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


 
 top of page
Method getString
Return string representation of this array.
Signature
getString():String
Returns
Stringnew 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
intindexWhere to insert the new element
floatfValue to insert
Returns
booleantrue 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
intnumDestChNumber of channels (in this array)
intdestChDestination channel index (in this array)
FloatArraysrcSource buffer
intnumSrcChNumber of source channels
intsrcChSource channel index
intnumChNumber of channels to copy
intnumElemNumber 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
FloatArrayoOther array
Returns
booleantrue if the array contents are equal

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

 
 top of page
Method loadFromStreamFloat32
Read 24bit IEEE floats from stream.
Signature
loadFromStreamFloat32(Streams,
  intnum 
  )  
 :boolean
Arguments
Streams
intnumNumber of samples to read
Returns
booleantrue 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
intnumNumber of samples to read
Returns
booleantrue 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
intnumNumber of samples to read
Returns
booleantrue 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
intnumNumber of samples to read
Returns
booleantrue 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
StreamifsInput stream
intnumNumber of elements to read
intdestOffDestination offset in this array
Returns
intNumber 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
StreamifsInput stream
intnumNumber of elements to read
intdestOffDestination offset in this array
Returns
intNumber of elements read

 
 top of page
Method realloc
Reallocate array to given size.
Signature
realloc(intmax)
 :boolean
Arguments
intmaxNew total number of elements
Returns
booleantrue 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
IntArrayorderHolds the new element array
Returns
booleantrue 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
floatsScale factor
Description

@todo Use operator =>

 
 top of page
Method setNumElements
Set the number of used elements to the given value.
Signature
setNumElements(intnum)
Arguments
intnumNew 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
IntArrayorderReceives the new element order

 
 top of page
Method sum
Sum elements
Signature
sum(intoff,
  intnum 
  )  
 :float
Arguments
intoffIndex of first element
intnumNumber of elements to sum
Returns
floatSum

 
 top of page
Method sumPathLen1d
Sum element deltas
Signature
sumPathLen1d(intoff,
  intnum 
  )  
 :float
Arguments
intoffIndex of first element
intnumNumber of elements to sum
Returns
floatPath length

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

 
 top of page
Method swap
Swap two array elements.
Signature
swap(intindexA,
  intindexB 
  )  
 :boolean
Arguments
intindexAIndex of first element
intindexBIndex of second element
Returns
booleantrue 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
FloatArraysrcSource array
intoffSource offset
intlenNumber of elements

 
 top of page
Method winCosine
Return cosine interpolation of elements.
Signature
winCosine(floatindex)
 :float
Arguments
floatindexElement index
Returns
floatInterpolated value
See also:  


 
 top of page
Method winCubic
Return cubic interpolation of elements.
Signature
winCubic(floatindex)
 :float
Arguments
floatindexElement index
Returns
floatInterpolated value
See also:  


 
 top of page
Method winLinear
Return linear interpolation of elements.
Signature
winLinear(floatindex)
 :float
Arguments
floatindexElement index
Returns
floatInterpolated value
See also:  


 
 top of page
Method winQuadratic
Return quadratic interpolation of elements.
Signature
winQuadratic(floatindex)
 :float
Arguments
floatindexElement index
Returns
floatInterpolated value
See also:  


 
 top of page
Method winQuintic
Return quintic interpolation of elements.
Signature
winQuintic(floatindex)
 :float
Arguments
floatindexElement index
Returns
floatInterpolated 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
StreamofsOutput stream
intnumNumber of elements to write
intsrcOffSource offset in this array
Returns
intNumber 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
StreamofsOutput stream
intnumNumber of elements to write
intsrcOffSource offset in this array
Returns
intNumber of elements written

 
 top of page
 

Project Modules:core 
Project Classes:Boolean , Buffer , Byte , Class , ClassArray , Condition , Configuration , Double , 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. Sun, 17/Aug/2014 16:22:27