// 1 data - 1 rule public static Boolean testRule(UKI_Data_AnalysisForm data, m_If rule) { Boolean pass = false; if (rule.type == TheMapData.if_type_2Joint) { double diff = 0; if (rule.axis == "X" || rule.axis == "Y" || rule.axis == "Z") { double v1 = getJointAxis(data.raw, rule.v, rule.axis); double v2 = getJointAxis(data.raw, rule.v2, rule.axis); diff = v1 - v2; } else { diff = TheTool.calEuclidian(getJoint(data.raw, rule.v), getJoint(data.raw, rule.v2)); } pass = TheTool.checkOpt(diff, rule.opt, rule.value_d); } else if (rule.type == TheMapData.if_type_BasicPose) { pass = UKI_DataBasicPose_checkBasicPosture(rule, data.bp); } else if (rule.type == TheMapData.if_type_Change) { double v1 = getJointAxis(data.raw, rule.v, rule.axis); double v2 = getJointAxis(TheInitialPosture.data_raw, rule.v2, rule.axis); double test_value = v1 - v2; pass = TheTool.checkOpt(test_value, rule.opt, rule.value_d); //TheSys.showError(v1 + " - " + v2 + " = " + test_value + rule.opt + rule.value_d); } else if (rule.type == TheMapData.if_type_SphereAngle) { Boolean azimuth = false; if (rule.value == TheMapData.then_SphereAngle_Azimuth) { azimuth = true; } double testValue = TheTool.calSpherical(getJoint(data.raw, rule.v), getJoint(data.raw, rule.v2), azimuth); pass = TheTool.checkOpt(testValue, rule.opt, rule.value_d); } else if (rule.type == TheMapData.if_type_FlexionAngle) { double testValue = 0; if (rule.v == "ElbowL") { testValue = ThePostureCal.calAngle_3Points(data.raw.ShoulderLeft, data.raw.ElbowLeft, data.raw.WristLeft); } else if (rule.v == "ElbowR") { testValue = ThePostureCal.calAngle_3Points(data.raw.ShoulderRight, data.raw.ElbowRight, data.raw.WristRight); } else if (rule.v == "KneeL") { testValue = ThePostureCal.calAngle_3Points(data.raw.HipLeft, data.raw.KneeLeft, data.raw.AnkleLeft); } else if (rule.v == "KneeR") { testValue = ThePostureCal.calAngle_3Points(data.raw.HipRight, data.raw.KneeRight, data.raw.AnkleRight); } pass = TheTool.checkOpt(testValue, rule.opt, rule.value_d); } return(pass); }