@ SuppressWarnings ( "unchecked" ) public double [ ] placement3DToMatrix ( AbstractHashMapVirtualObject ifcAxis2Placement3D ) { EReference refDirectionFeature = packageMetaData . getEReference ( "IfcAxis2Placement3D" , "RefDirection" ) ; AbstractHashMapVirtualObject location = ifcAxis2Placement3D . getDirectFeature ( packageMetaData . getEReference ( "IfcPlacement" , "Location" ) ) ; if ( ifcAxis2Placement3D . getDirectFeature ( packageMetaData . getEReference ( "IfcAxis2Placement3D" , "Axis" ) ) != null && ifcAxis2Placement3D . getDirectFeature ( refDirectionFeature ) != null ) { AbstractHashMapVirtualObject axis = ifcAxis2Placement3D . getDirectFeature ( packageMetaData . getEReference ( "IfcAxis2Placement3D" , "Axis" ) ) ; AbstractHashMapVirtualObject direction = ifcAxis2Placement3D . getDirectFeature ( refDirectionFeature ) ; List < Double > axisDirectionRatios = ( List < Double > ) axis . get ( "DirectionRatios" ) ; List < Double > directionDirectionRatios = ( List < Double > ) direction . get ( "DirectionRatios" ) ; List < Double > locationCoordinates = ( List < Double > ) location . get ( "Coordinates" ) ; double [ ] cross = Vector . crossProduct ( new double [ ] { axisDirectionRatios . get ( 0 ) , axisDirectionRatios . get ( 1 ) , axisDirectionRatios . get ( 2 ) , 1 } , new double [ ] { directionDirectionRatios . get ( 0 ) , directionDirectionRatios . get ( 1 ) , directionDirectionRatios . get ( 2 ) , 1 } ) ; return new double [ ] { directionDirectionRatios . get ( 0 ) , directionDirectionRatios . get ( 1 ) , directionDirectionRatios . get ( 2 ) , 0 , cross [ 0 ] , cross [ 1 ] , cross [ 2 ] , 0 , axisDirectionRatios . get ( 0 ) , axisDirectionRatios . get ( 1 ) , axisDirectionRatios . get ( 2 ) , 0 , locationCoordinates . get ( 0 ) , locationCoordinates . get ( 1 ) , locationCoordinates . get ( 2 ) , 1 } ; } else if ( location != null ) { List < Double > locationCoordinates = ( List < Double > ) location . get ( "Coordinates" ) ; return new double [ ] { 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 , 0 , locationCoordinates . get ( 0 ) , locationCoordinates . get ( 1 ) , locationCoordinates . get ( 2 ) , 1 } ; } return Matrix . identity ( ) ; }
Pretty sure this is working correctly