quarta-feira, 8 de outubro de 2014

size of vector data


// vector of pointer to T class 
std::vector<T*> animais;

// add new T instance object , into the animais vector pointer 
animais.pushBack( new T() );
animais.pushBack( new T() );


//  show size in bytes , kbytes , megaBytes 
std::cout << (animais.size() * sizeof(std::vector<T>))<<"bytes" << std::endl;
std::cout << (animais.size() * sizeof(std::vector<pessoa>))/ 1024 <<"kb" << std::endl;
std::cout << (animais.size() * sizeof(std::vector<pessoa>))/ 1048576 <<"mb" << std::endl;

Convert Bytes to KiloBytes, MegaBytes, Gigabytes

1 KB = 1024 B 
1 MB = 1048576 B = 1024 KB 
1 GB = 1073741824 B = 1048576 KB = 1024 MB


So... the formula is 

X KB = NumberOfBytes/1024
X MB = NumberOfBytes/1048576 'or X MB = NumberOfBytes/1024/1024

etc, etc.

terça-feira, 30 de setembro de 2014

multidimensional array and pseudo-multidimensional array



#2D array access 
#define WIDTH 5
#define HEIGHT 3

int jimmy [HEIGHT][WIDTH];
int n,m;

int main ()
{
  for (n=0; n<HEIGHT; n++)
    for (m=0; m<WIDTH; m++)
    {
      jimmy[n][m]=(n+1)*(m+1);
    }
}



#1D array access

#define WIDTH 5
#define HEIGHT 3

int jimmy [HEIGHT * WIDTH];
int n,m;

int main ()
{
  for (n=0; n<HEIGHT; n++)
    for (m=0; m<WIDTH; m++)
    {
      jimmy[n*WIDTH+m]=(n+1)*(m+1);
    }
}

sábado, 27 de setembro de 2014

REMAP function and LERP function


remap range:
double fit(double index, double old_min, double old_max, double new_min,double new_max)
{
    return new_min + (new_max - new_min) * (index - old_min) / (old_max- old_min);
}
usage :
fit(0.5, 0, 1, 10, 20);
>> 15.0
>>

LERP: 
Precise method which guarantees v = v1 when t = 1.

float lerp(float v0, float v1, float t)
{
  return (1-t)*v0 + t*v1;
}

sábado, 9 de agosto de 2014

PadZero in string Parameters Houdini

create string parameters keyframe
then edit expression

Python:
hou.node("..").name() + '_%03d' % hou.intFrame()

hou.node("..").name() : parent name 

*/ works for Integers  Floats and Strings*/ 
 '_%03d' % hou.intFrame() : pad3 decimals places  using Frame as base number    

****another method only for strings*****:

n = '4'
print n.zfill(3)
>>> '004'



HScript:

opname("..")+"_" + padzero(3,"$F") 


opname(".."): parent name 

padzero(3,"$F")  :pad3 decimals places  using Frame as base number




quinta-feira, 6 de fevereiro de 2014

RealFLow 2 vray VectorBlur


Use wildcards!  and convert to vrmesh
using ply2vrmesh app

./ply2vrmesh.exe "/Users/chrysl666/Desktop/TNT/VRAY_proxyMesh/meshExp11_01_*.bin" 


Then load one vrmesh file from the sequence  and change its path:
/Users/chrysl666/Desktop/TNT/VRAY_proxyMesh/meshExp11_01_0001.vrmesh

to something like this:
/Users/chrysl666/Desktop/TNT/VRAY_proxyMesh/meshExp11_01_%04d.vrmesh
ready to render using velocity path !



terça-feira, 4 de fevereiro de 2014

RealFLow 2013 CommandLIne

command line example for meshing in Osx:


"/Applications/RealFlow 2013/RealFlow.app/Contents/MacOS/RealFlow64"  -mesh -range 44 44 "/Users/chrysl666/Desktop/TNT/RF_explosion/RF_explosion.flw"