The size of "area" is the same after scaling
#4
No, there's no resetxform in tyFlow currently.

If you require an accurate readout, you can calculate the surface area using the Script operator manually...it's a fairly simple process.

Triangle area is half the length of the cross product of the two vectors formed by the triangle's vertices. Then you just add up the area of all the triangles and you have the surface area. If doing it with the mesh operator, make sure to multiply the vertex positions by the particle's transform...that's how you convert them from local space into world space. Here's a script that calculates the surface area of all particles in the event and puts it into an "area" custom float property.

Code:
public void simulationStep()
{    
    
    for (int i = 0; i < eventParticleCount; i++)             
    {
        int sInx = tf.GetSimIndex(i);

        var mesh = tf.GetMesh(sInx);
        var tm = tf.GetTM(sInx);
        float surfaceArea = 0;
        
        for (int q = 0; q < mesh.GetNumFaces(); q++)
        {
            var face = mesh.GetFace(q);
            var v1 = (mesh.GetVert(face.v1) * tm) - (mesh.GetVert(face.v2) * tm);
            var v2 = (mesh.GetVert(face.v3) * tm) - (mesh.GetVert(face.v2) * tm);            
            float faceArea = (Cross(v1, v2)).magnitude * 0.5f;            
            surfaceArea += faceArea;
        }
        
        tf.SetCustomFloat(sInx, "area", surfaceArea);
    }    
}
  Reply


Messages In This Thread
RE: The size of "area" is the same after scaling - by tyFlow - 07-18-2022, 02:58 AM

Forum Jump: