Commit 333cbec1 authored by Cory Quammen's avatar Cory Quammen

Invert the effect of the scale factor

The scale factor was applied in an inverted fashion. The
distance should be scaled and the ruler distance scaled by the
inverse scale factor.
parent 8364eb78
......@@ -97,8 +97,8 @@ public:
// will be defined in terms of the scaled space. For example, if the VTK world
// coordinates are assumed to be in inches, but the desired distance units
// should be defined in terms of centimeters, the scale factor should be set
// to 0.3937. The ruler marks will then be spaced in terms of centimeters, and
// the label will contain the measurement in centimeters.
// to 2.54. The ruler marks will then be spaced in terms of centimeters, and
// the label will show the measurement in centimeters.
vtkSetMacro(Scale,double);
vtkGetMacro(Scale,double);
......
......@@ -183,16 +183,14 @@ void vtkDistanceRepresentation2D::BuildRepresentation()
this->AxisActor->GetPoint1Coordinate()->SetValue(p1);
this->AxisActor->GetPoint2Coordinate()->SetValue(p2);
this->AxisActor->SetRulerMode(this->RulerMode);
this->AxisActor->SetRulerDistance(this->RulerDistance * this->Scale);
this->AxisActor->SetNumberOfLabels(this->NumberOfRulerTicks);
double scaledDistance = this->Distance;
if (this->Scale != 0.0)
{
scaledDistance /= this->Scale;
this->AxisActor->SetRulerDistance(this->RulerDistance / this->Scale);
}
this->AxisActor->SetNumberOfLabels(this->NumberOfRulerTicks);
char string[512];
sprintf(string, this->LabelFormat, scaledDistance);
sprintf(string, this->LabelFormat, this->Distance * this->Scale);
this->AxisActor->SetTitle(string);
this->BuildTime.Modified();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment