Need a bit of help. I have a bit of code that I am using to find the longest distance between any 2 verts on a single polygon object. I have pasted a bit of the code below. It all seems to work find, but the issue is that it just takes to damn long on object that have lots of verts. Can anyone offer suggestions that may yeild the same results, but quicker.
string $objList[] = `ls -sl`;
string $objSelected;
for($objSelected in $objList){
select $objSelected;
ConvertSelectionToVertices;
string $vertList[] = `ls -sl -fl`;
string $vertSelected;
float $storeDistance = 0;
for($vertSelected in $vertList){
vector $wsPosStart = `xform -q -ws -t $vertSelected`;
string $diffList[] = stringArrayRemove({$vertSelected} , $vertList);
for($diffSelected in $diffList){
vector $wsPosEnd = `xform -q -ws -t $diffSelected`;
float $checkDistance = (sqrt((($wsPosEnd.x - $wsPosStart.x)*($wsPosEnd.x - $wsPosStart.x)) + (($wsPosEnd.y - $wsPosStart.y)*($wsPosEnd.y - $wsPosStart.y)) + (($wsPosEnd.z - $wsPosStart.z)*($wsPosEnd.z - $wsPosStart.z))));
if($checkDistance > $storeDistance){
$storeDistance = $checkDistance;
}
}
}
print ($storeDistance + "is the longest distance between any 2 verts");
}