MantisBT - ParaView
View Issue Details
0013093ParaViewFeaturepublic2012-04-13 10:342012-10-29 17:04
Ian Curington 
Sebastien Jourdain 
highminorhave not tried
closedfixed 
3.14.1 
3.98.0 
ParaViewPro
13262-non-orthogonal-source-plugin
usability
0013093: Cube Axes Labelling Untransformed ranges
PROBLEM:
   If mesh is transformed using Display tab (Z*10, etc) cube axes show only result of this transform, not original mesh coordinates in tics and labels.

SOLUTION:
   Add additional option toggle, letting user set application specific context of tic labels, either transformed or untransformed. Make default transformed, so will not be disruptive change.

PATCH:
   patched files: vtkCubeAxesRepresentation.[h,cxx], pqCubeAxesEditorDialog.cxx, pqCubeAxesEditorDialog.ui, views_and_representations.xml
   action: copy vtkCubeAxesRepresentation.[h,cxx] to ParaView-3.14.0/ParaViewCore/ClientServerCore
           copy pqCubeAxesEditorDialog.cxx to ParaView-3.14.0/Qt/Components
           copy pqCubeAxesEditorDialog.ui to ParaView-3.14.0/Qt/Components/Resources/UI
           copy views_and_representations.xml to ParaView-3.14.0/ParaViewCore/ServerImplementation/Resources

DESCRIPTION: When we load terrain mesh, scale it along Z axis (e.g. x5) and turn on cube axes around that pipeline item, axes labels for Z axis range will also be scaled (x5). In case we want to represent terrain's elevation by using cube axes, or generally to represent original data's extent with axes, this scaling will make cube axes inappropriate. To fix this behavior, our patch adds new property, UnscaledTicks, which controls if tick labels on axes are generated from original data or from transformed representation.

CHANGES: To make this patch, following changes were made (ParaView source patch):

       - vtkCubeAxesRepresentation.[h,cxx] - Added UnscaledTicks property and Set[XYZ]AxisRange() / SetBounds() logic depending on flag's value,
       - views_and_representations.xml - Added UnscaledTicks PQ property to vtkCubeAxesRepresentation class,
       - pqCubeAxesEditorDialog.ui - Added UnscaledTicks check-box to Cube Axes Editor Dialog,
       - pqCubeAxesEditorDialog.cxx - Added registering of PQ link between UnscaledTicks check box and representation property.

No tags attached.
? vtkCubeAxesRepresentation.h (6,038) 2012-04-13 10:34
https://www.vtk.org/Bug/file/9159/vtkCubeAxesRepresentation.h
cxx vtkCubeAxesRepresentation.cxx (14,077) 2012-04-13 10:35
https://www.vtk.org/Bug/file/9160/vtkCubeAxesRepresentation.cxx
cxx pqCubeAxesEditorDialog.cxx (7,687) 2012-04-13 10:35
https://www.vtk.org/Bug/file/9161/pqCubeAxesEditorDialog.cxx
? pqCubeAxesEditorDialog.ui (16,465) 2012-04-13 10:36
https://www.vtk.org/Bug/file/9162/pqCubeAxesEditorDialog.ui
xml views_and_representations.xml (173,524) 2012-04-13 10:36
https://www.vtk.org/Bug/file/9163/views_and_representations.xml
Issue History
2012-04-13 10:34Ian CuringtonNew Issue
2012-04-13 10:34Ian CuringtonFile Added: vtkCubeAxesRepresentation.h
2012-04-13 10:35Ian CuringtonFile Added: vtkCubeAxesRepresentation.cxx
2012-04-13 10:35Ian CuringtonFile Added: pqCubeAxesEditorDialog.cxx
2012-04-13 10:36Ian CuringtonFile Added: pqCubeAxesEditorDialog.ui
2012-04-13 10:36Ian CuringtonFile Added: views_and_representations.xml
2012-04-23 10:37Utkarsh AyachitCategory(No Category) => Feature
2012-04-23 10:41Utkarsh AyachitProjectTBD => ParaViewPro
2012-06-07 17:15LawrenceNote Added: 0028677
2012-06-07 17:47LawrenceNote Edited: 0028677bug_revision_view_page.php?bugnote_id=28677#r450
2012-06-25 13:36Cory QuammenNote Added: 0028720
2012-07-05 17:02LawrenceNote Added: 0028745
2012-07-11 15:44LawrenceNote Added: 0028765
2012-07-12 16:42Sebastien JourdainAssigned To => Sebastien Jourdain
2012-07-12 16:42Sebastien JourdainStatusbacklog => todo
2012-07-12 16:42Sebastien JourdainStatustodo => active development
2012-07-12 16:43Sebastien JourdainTopic Name => 13262-non-orthogonal-source-plugin
2012-07-12 16:43Sebastien JourdainStatusactive development => gatekeeper review
2012-07-12 16:43Sebastien JourdainResolutionopen => fixed
2012-07-12 16:45Sebastien JourdainNote Added: 0028769
2012-07-13 10:41Utkarsh AyachitFixed in Version => git-master
2012-07-13 10:41Utkarsh AyachitStatusgatekeeper review => customer review
2012-07-13 10:41Utkarsh AyachitNote Added: 0028774
2012-07-13 16:49LawrenceNote Added: 0028780
2012-07-13 16:54Sebastien JourdainNote Added: 0028781
2012-07-16 12:42LawrenceNote Added: 0028782
2012-07-18 17:02Ian CuringtonNote Added: 0028796
2012-07-19 10:50Sebastien JourdainNote Added: 0028846
2012-07-19 10:50Sebastien JourdainStatuscustomer review => gatekeeper review
2012-07-19 10:50Sebastien JourdainStatusgatekeeper review => active development
2012-07-19 10:50Sebastien JourdainStatusactive development => gatekeeper review
2012-07-20 11:42Ian CuringtonNote Added: 0028889
2012-07-24 10:48Utkarsh AyachitStatusgatekeeper review => customer review
2012-07-24 10:48Utkarsh AyachitNote Added: 0028899
2012-07-25 16:53Alan ScottNote Added: 0028937
2012-07-25 16:53Alan ScottStatuscustomer review => closed
2012-10-29 17:04Utkarsh AyachitFixed in Versiongit-master => 3.98.0

Notes
(0028677)
Lawrence   
2012-06-07 17:15   
(edited on: 2012-06-07 17:47)
This may also be a solution to
http://paraview.org/Bug/view.php?id=12615 [^]

I'd be very happy to see this bug fix in. Axes on an object should represent the underlying space of the object; not any display scaling. I'd prefer that the default is disruptive; as it is almostly always correct.

So far Paraview does not handle asymmetric scaling of objects well (many of the widgets do not display correctly). This would be a step in the right direction.

(0028720)
Cory Quammen   
2012-06-25 13:36   
I would like to add my voice to support this feature. I have users in high-energy particle physics who really want to scale one axis and have the axis labels reflect the original coordinates.
(0028745)
Lawrence   
2012-07-05 17:02   
The suggested solution is incomplete (e.g. if the object is rotated and scaled). Also, there seem to be some issues when the Z scale is set back to one. I'll investigate this further.
(0028765)
Lawrence   
2012-07-11 15:44   
Update -
Setting the Z scale back to one turned out to be a vkt bug. Described and suggested fix here-
http://vtk.org/Bug/view.php?id=13300 [^]

VTK does not yet support rotated (object-aligned axes), so Paraview cannot properly support rotated _and_ scaled.

My preference for this (13093) bug is that the axes _always_ use the object's original coordinates. I'll be able to suggest a much simpler fix to this bug shortly. (i.e. my personal opinion as a non-Paraview developer is that the GUI options in the above files are unnecessary). Best,Lawrence.
(0028769)
Sebastien Jourdain   
2012-07-12 16:45   
I've updated the UI to allow the user to specify any custom range he want. So the scaling won't work as ON/OFF, but a more as a range that the user will have to specify.
(0028774)
Utkarsh Ayachit   
2012-07-13 10:41   
merged into master (if applicable)
(0028780)
Lawrence   
2012-07-13 16:49   
Ouch. From the description above, I'm concerned this is not sufficient to automatically proper axes display of scaled and translated geographic surfaces. Please can I suggest the following alternative fix is sufficient to handle scaled and translated objects.
NB Rotated and scaled objects cannot be supported until VTK object-(rotate)-aligned axis is ready.

The following fix has been tested with wavelet source translated AND/OR scaled with default and CUSTOM bounds.

void vtkCubeAxesRepresentation::UpdateBounds()
{
  double *scale = this->Scale;
  double *position = this->Position;
  double *rotation = this->Orientation;

  double unscaledBounds[6];
  double transformedBounds[6];

  this->GetDataBounds(unscaledBounds);
  for(int i = 0;i < 6; i++)
      {
      if(this->CustomBoundsActive[ i / 2 ])
        {
        unscaledBounds[i] = this->CustomBounds[i];
        }
    }

  vtkSmartPointer<vtkTransform> transform =
      vtkSmartPointer<vtkTransform>::New();
  transform->Translate(position);
  transform->RotateZ(rotation[2]);
  transform->RotateX(rotation[0]);
  transform->RotateY(rotation[1]);
  transform->Scale(scale);
  vtkBoundingBox bbox;
  int i, j, k;
  double origX[3], x[3];
  // Visit all 8 corners of the transformed bounding box
  // NB This code will be unnecessary once axes can be aligned with rotated objects
  for (i = 0; i < 2; i++)
  {
      origX[0] = unscaledBounds[i];
      for (j = 0; j < 2; j++)
      {
          origX[1] = unscaledBounds[2 + j];
          for (k = 0; k < 2; k++)
          {
              origX[2] = unscaledBounds[4 + k];
              transform->TransformPoint(origX, x);
              bbox.AddPoint(x);
          }
      }
  }
  bbox.GetBounds(transformedBounds);

  this->CubeAxesActor->SetBounds(transformedBounds);
  if(UseBoundsRangeAsLabel)
    {
// vtkPrismCubeAxesRepresentation explicitly sets the bounds and sets UseBoundsRangeAsLabel to false
// Use the original (unscaled, untranslated) object range as the axes range to display
    this->CubeAxesActor->SetXAxisRange(&unscaledBounds[0]);
    this->CubeAxesActor->SetYAxisRange(&unscaledBounds[2]);
    this->CubeAxesActor->SetZAxisRange(&unscaledBounds[4]);
    }
}
(0028781)
Sebastien Jourdain   
2012-07-13 16:54   
Custom bounds and custom range are two different things that can work along independently.
I don't see how it can't work as we don't care about scaling and translation, we just label the axis from two arbitrary values... So the ticks will reflect only what you are interested in.
(0028782)
Lawrence   
2012-07-16 12:42   
The arbitrary labels may be useful for some, but not for our geologist users.

Here's what the typical Use case: Geologist performs a global Z rescale of all objects in the scene (we have GUI toolbar to do this, or uses the Scale entry in the Display tab; geological objects tend to be very very wide and very flat). They do not want to hand-edit the axes bounds values of all items, every time the scale is change.

The displayed range of the object should just be underlying coordinate values.
So my preference would be- It's great that you allow arbitrary values, but please please use the original unscaled bounds of the object not the transformed coordinate system.

e.g. If you make a unit box (range -0.5 .. 0.5) or a wavelet source (range -10..10) and scale along Z by 4 and translate along Z by 10 using the Display Tab, the axes bounds should still show the original range.

(The above code does this; I hope there's a way to integrate it into your revised code to ensure untransformed bound vales are used for the displayed range.)
Hope this makes sense. Thanks!
(0028796)
Ian Curington   
2012-07-18 17:02   
Thank you for the discussion, I think it is very helpful. I agree that my patch assumes scaling is non-rotated, axis aligned. I think this is the most common case, and certainly what we use in earth science applications. I don't know full scope of possible application, so I can see it should be extended for that case. We added UI control toggle, so it would not break current usage, but in our applications we leave it turned on for unscaled label mode. I also agree with Lawrence, I don't see such value in arbitrary labels here. Thanks!
(0028846)
Sebastien Jourdain   
2012-07-19 10:50   
Latest related notes are solved in 13093-allow-non-scaled-range-for-cube-axes
(0028889)
Ian Curington   
2012-07-20 11:42   
Thank you!
(0028899)
Utkarsh Ayachit   
2012-07-24 10:48   
merged into master, if applicable.
(0028937)
Alan Scott   
2012-07-25 16:53   
Tested local server, Linux, master.