MantisBT - VTK
View Issue Details
0002903VTK(No Category)public2006-02-22 11:242013-04-05 19:57
Randall Hand 
Zhanping Liu 
urgentminoralways
closedopen 
 
 
0002903: vtkArrayCalculator does not support Cross Products
the existing vtkArrayCalculator (in both VTK & ParaView) does not support computation of Cross Products. As this is important in my work, I modified the Common/vtkFunctionParser.cxx/h to support a "cross" function that takes 2 vectors as input.
No tags attached.
cxx vtkFunctionParser.cxx (58,630) 1969-12-31 19:00
https://www.vtk.org/Bug/file/5467/vtkFunctionParser.cxx
? vtkFunctionParser.h (8,616) 1969-12-31 19:00
https://www.vtk.org/Bug/file/5468/vtkFunctionParser.h
Issue History
2008-09-25 15:29Berk GeveciAssigned ToMathieu Malaterre => Zhanping Liu
2008-10-09 18:40Zhanping LiuNote Added: 0013828
2008-10-09 18:42Zhanping LiuStatustabled => @80@
2008-10-09 18:42Zhanping LiuDescription Updated
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2013-04-05 19:57Berk GeveciStatuscustomer review => closed

Notes
(0013828)
Zhanping Liu   
2008-10-09 18:40   
randall.hand once suggested the addition of the support for the vector cross product operator. It was added some time later. Then some new operators such as boolean ones were added and during this process unfortunately the vector cross product operator was carelessly disabled due to the incorrect check on the number of the input parameters.

The correct format of a vector cross product operation is:

    ====================================
    vector_C = cross(vector_A, vector_B)
    ====================================

    INSTEAD OF

    ====================================
    cross(vector_A, vector_B, vector_C)
    ====================================
    
    In other words, there should be TWO parameters and ONE comma.

    However, the bug in vtkFunctionParser:: CheckSyntax() occurred within the following segment (between line 1444 and line 1453):

    ============================================================
    if ((functionNumber == VTK_PARSER_MIN) ||
        (functionNumber == VTK_PARSER_MAX))
      {
      expectCommaOnParenthesisCount[parenthesisCount+1] = 1;
      }
    if ((functionNumber == VTK_PARSER_IF) ||
        (functionNumber == VTK_PARSER_CROSS))
      {
      expectTwoCommasOnParenthesisCount[parenthesisCount+1] = 1;
      }
    ============================================================

    Now this segment has been replaced with

    ============================================================
    if ((functionNumber == VTK_PARSER_MIN) ||
        (functionNumber == VTK_PARSER_MAX) ||
        (functionNumber == VTK_PARSER_CROSS))
      {
      expectCommaOnParenthesisCount[parenthesisCount+1] = 1;
      }
    if (functionNumber == VTK_PARSER_IF)
      {
      expectTwoCommasOnParenthesisCount[parenthesisCount+1] = 1;
      }
    ============================================================
      
    Now the code performs correct check on the input format in terms of vector cross product and the suggested functionality is supported.

      Thanks for suggesting the enhancement.
  
      new revision: 1.43; previous revision: 1.42