//==================================================================
void VISU_ImplicitFunctionWidget::SetDistance(const float theDistance)
{
+ if( theDistance <= 0.0 || theDistance == myDistance )
+ return;
+
myDistance=theDistance;
//
float *origin, *normal, oNew[3], aN2[3];
//==================================================================
void VISU_ImplicitFunctionWidget::PushDistance(double *p1, double *p2)
{
- float v[3], *anOrigin1, *aN1, *anOrigin2, aD;
+ float v[3], *anOrigin1, *aN1, *anOrigin2, *aN2, aD;
//Get the motion vector
v[0] = p2[0] - p1[0];
v[1] = p2[1] - p1[1];
v[2] = p2[2] - p1[2];
//
- myPlane2->Push( vtkMath::Dot(v, myPlane2->GetNormal()));
anOrigin1 = Plane->GetOrigin();
aN1 = Plane->GetNormal();
- vtkMath::Normalize(aN1);
anOrigin2 = myPlane2->GetOrigin();
+ aN2 = myPlane2->GetNormal();
+
+ vtkMath::Normalize(aN1);
+
+ float* origin = new float[3];
+ double distance = vtkMath::Dot( v, aN2 );
+ for( int i = 0; i < 3; i++ )
+ origin[i] = anOrigin2[i] + distance * aN2[i];
+ float d = DistanceToPlane(origin, aN1, anOrigin1);
+ delete [] origin;
+
+ if( d <= 0.0 )
+ return;
+
+ myPlane2->Push( vtkMath::Dot(v, myPlane2->GetNormal()));
aD=DistanceToPlane(anOrigin2, aN1, anOrigin1);
//
myDistance=aD;
(bounds[3]+bounds[2])/2.0,
(bounds[5]+bounds[4])/2.0);
- static float DIST_COEFF = 0.33;
+ static float DIST_COEFF = 0.1;
SetDistance(this->InitialLength*DIST_COEFF);
this->UpdateRepresentation();