Browse Source

髋臼水平角 橙色线(右侧髋臼上缘切线)及其延长线和脊柱轴心线的垂线夹角,画 脊柱轴心线的垂线时,应该和 右侧髋臼切线起点和终点在同一侧

sw 1 month ago
parent
commit
c8ddafb5b4

+ 5 - 0
src/components/measures/DARAMeasurementTool.README.md

@@ -146,6 +146,11 @@ const leftTangentVector = vectorSubtract(leftPoint6, leftPoint5);
 // 垂线向量计算(垂直于脊柱轴心线)
 const perpendicularVector = calculatePerpendicularVector(spineAxisVector);
 
+// 注意:对于右侧髋臼,垂线向量在渲染时会反转方向(vectorScale(perpendicularVector, -1)),
+// 以确保垂线与右侧髋臼切线起点和终点在同一侧。
+// 角度弧线也会相应调整:如果角度是锐角,使用反向切线向量;如果是钝角,使用原向切线向量,
+// 以确保弧线绘制在延长线和垂线夹的锐角侧。
+
 // 角度计算(切线与垂线的夹角)
 const angle = getAngleBetweenLines(tangentVector, perpendicularVector);
 ```

+ 8 - 6
src/components/measures/DARAMeasurementTool.ts

@@ -1544,7 +1544,8 @@ export default class DARAMeasurementTool extends AnnotationTool {
         const rightPerpConfig = { ...DEFAULT_RIGHT_PERPENDICULAR };
 
         const perpendicularLengthD = rightPerpConfig.length;
-        const perpendicularEndD = vectorAdd(intersectionD, decomposeVectorOnAxes(cachedStats.perpendicularVector, perpendicularLengthD));
+        // 反转垂线向量方向,确保与右侧髋臼切线起点和终点在同一侧
+        const perpendicularEndD = vectorAdd(intersectionD, decomposeVectorOnAxes(vectorScale(cachedStats.perpendicularVector, -1), perpendicularLengthD));
         const perpendicularEndDCanvas = viewport.worldToCanvas(perpendicularEndD);
         const perpendicularLineDUID = `${annotationUID}-perpendicular-right`;
         const perpendicularLineDOptions = {
@@ -1563,12 +1564,13 @@ export default class DARAMeasurementTool extends AnnotationTool {
         );
 
         // 绘制角度弧线(垂线与右髋臼切线之间的夹角)
-        // 将3D向量转换为2D向量用于绘制
-        const perpendicularVector2D: CoreTypes.Point2 = [cachedStats.perpendicularVector[0], cachedStats.perpendicularVector[1]];
-        let rightTangentVector2D: CoreTypes.Point2 = [cachedStats.rightTangentVector[0], cachedStats.rightTangentVector[1]];
-        //如果钝角,使用反向向量,为了画锐角的弧线
+        // 将3D向量转换为2D向量用于绘制,反转垂线向量以匹配右侧方向
+        const perpendicularVector2D: CoreTypes.Point2 = [-cachedStats.perpendicularVector[0], -cachedStats.perpendicularVector[1]];
+        // 调整切线向量以确保弧线绘制在锐角侧
+        let rightTangentVector2D: CoreTypes.Point2 = [-cachedStats.rightTangentVector[0], -cachedStats.rightTangentVector[1]];
+        // 如果钝角,使用原向向量;如果是锐角,使用反向向量
         if (cachedStats.angleRightOrigin > 90) {
-          rightTangentVector2D = [-cachedStats.rightTangentVector[0], -cachedStats.rightTangentVector[1]];
+          rightTangentVector2D = [cachedStats.rightTangentVector[0], cachedStats.rightTangentVector[1]];
         }
         // 创建弧线点数组
         const arcRadiusD = 30; // 弧线半径