@@ -115,58 +115,6 @@ export function getCropFilter(pxm, proxy) {
115115 return volRep . getCropFilter ( ) ;
116116}
117117
118- /**
119- * Function adapted from getLPSDirections lps.ts from VolView.
120- * Associates the column vectors of a 3x3 matrix with the LPS axes.
121- *
122- * For each of the LPS axes, this function returns the associated column index (0, 1, 2)
123- * in the provided 3x3 column-major matrix and the corresponding positive vector.
124- *
125- * Approach:
126- * - find the max of the direction matrix, ignoring columns and rows marked as done
127- * - assign the column vector of that max value to the row axis
128- * - mark that row and column as done
129- * - continue until all rows and columns are done
130- */
131- export function getLPSDirections ( directionMatrix ) {
132- const axisToLPS = [ 'l' , 'p' , 's' ] ;
133- const lpsDirs = { } ;
134- // Track the rows and columns that have yet to be assigned.
135- const availableCols = [ 0 , 1 , 2 ] ;
136- const availableRows = [ 0 , 1 , 2 ] ;
137-
138- for ( let i = 0 ; i < 3 ; i ++ ) {
139- let bestValue = 0 ;
140- let bestValueLoc = [ 0 , 0 ] ; // col, row
141- let removeIndices = [ 0 , 0 ] ; // indices into availableCols/Rows for deletion
142-
143- availableCols . forEach ( ( col , colIdx ) => {
144- availableRows . forEach ( ( row , rowIdx ) => {
145- const value = directionMatrix [ col * 3 + row ] ;
146- if ( Math . abs ( value ) > Math . abs ( bestValue ) ) {
147- bestValue = value ;
148- bestValueLoc = [ col , row ] ;
149- removeIndices = [ colIdx , rowIdx ] ;
150- }
151- } ) ;
152- } ) ;
153-
154- // the row index corresponds to the index of the LPS axis
155- const [ col , axis ] = bestValueLoc ;
156- const axisVector = directionMatrix . slice ( col * 3 , ( col + 1 ) * 3 ) ;
157- const vecSign = Math . sign ( bestValue ) ;
158- const posVector = vec3 . scale ( Array ( 3 ) , axisVector , vecSign ) ;
159- lpsDirs [ axisToLPS [ axis ] ] = {
160- axis : col ,
161- vector : posVector ,
162- } ;
163- availableCols . splice ( removeIndices [ 0 ] , 1 ) ;
164- availableRows . splice ( removeIndices [ 1 ] , 1 ) ;
165- }
166-
167- return lpsDirs ;
168- }
169-
170118/**
171119 * Associate a key of VIEW_TYPE_VALUES to axis index and orientation
172120 * for forward and upward vectors.
@@ -201,7 +149,7 @@ const MODE_TO_AXES = {
201149/**
202150 * Update the camera view using the given arguments:
203151 * - view which is a vtkViewProxy
204- * - basis, a list of 3 vec3 defining a basis
152+ * - basis, a column major matrix defining a basis
205153 * - mode, a key of VIEW_TYPE_VALUES
206154 * - an optional number of animateSteps
207155 *
@@ -221,12 +169,12 @@ export function updateViewOrientationFromBasisAndAxis(
221169 MODE_TO_AXES [ mode ] ;
222170 const forwardVector = vec3 . scale (
223171 Array ( 3 ) ,
224- basis [ forwardAxis ] ,
172+ basis . slice ( forwardAxis * 3 , forwardAxis * 3 + 3 ) ,
225173 forwardOrientation
226174 ) ;
227175 const upwardVector = vec3 . scale (
228176 Array ( 3 ) ,
229- basis [ upwardAxis ] ,
177+ basis . slice ( upwardAxis * 3 , upwardAxis * 3 + 3 ) ,
230178 upwardOrientation
231179 ) ;
232180
@@ -268,6 +216,5 @@ export default {
268216 remapIdList,
269217 createRepresentationInAllViews,
270218 getCropFilter,
271- getLPSDirections,
272219 updateViewOrientationFromBasisAndAxis,
273220} ;
0 commit comments