Black Trigram (흑괘) - Korean Martial Arts Combat Simulator API - v0.7.0
    Preparing search index...

    Class CoordinateMapper

    Coordinate Mapper for converting 2D pixel coordinates to 3D world coordinates.

    Korean: 좌표 변환기

    Provides bidirectional mapping between the 2D UI overlay coordinate system and the 3D physics world coordinate system.

    좌표변환기

    Index

    Constructors

    Methods

    • Calculates the distance between a 3D point and a vital point's 3D position.

      Korean: 거리 계산

      Parameters

      • point3D: Position3D

        Point in 3D world space

      • vitalPoint: VitalPoint

        Vital point to measure distance to

      Returns number

      Distance in meters

      const mapper = new CoordinateMapper();
      const attackPoint = { x: 0, y: 1.5, z: 0.1 };
      const temple = VITAL_POINTS_DATA.find(vp => vp.id === "head_temple");
      const distance = mapper.distanceToVitalPoint(attackPoint, temple);
    • Finds the closest vital point to a 3D position within a given region.

      Korean: 가장 가까운 급소 찾기

      Parameters

      Returns { distance: number; vitalPoint: VitalPoint } | null

      Closest vital point and distance, or null if none found

      const mapper = new CoordinateMapper();
      const hitPoint = { x: 0, y: 1.7, z: 0.05 };
      const result = mapper.findClosestVitalPoint(hitPoint, VITAL_POINTS_DATA, "head");
      if (result) {
      console.log(`Hit ${result.vitalPoint.names.english} at ${result.distance}m`);
      }
    • Converts a 2D pixel position to a 3D world position.

      Korean: 2D → 3D 변환

      Maps UI overlay pixel coordinates to 3D world space coordinates suitable for physics collision detection.

      Parameters

      Returns Position3D

      3D world position in meters (origin at character center)

      const mapper = new CoordinateMapper();
      const vitalPoint = { position: { x: 100, y: 50 } };
      const worldPos = mapper.pixel2DToWorld3D(vitalPoint.position, "head");
      // worldPos: { x: 0, y: 1.45, z: 0.05 }
    • Converts a vital point's 2D position to 3D world position.

      Korean: 급소 위치 변환

      Convenience method that extracts position and region from a VitalPoint object.

      Parameters

      • vitalPoint: VitalPoint

        Vital point with 2D position

      Returns Position3D

      3D world position

      const mapper = new CoordinateMapper();
      const temple = VITAL_POINTS_DATA.find(vp => vp.id === "head_temple");
      const worldPos = mapper.vitalPointToWorld3D(temple);
    • Converts a 3D world position to a 2D pixel position.

      Korean: 3D → 2D 변환

      Maps 3D world space coordinates back to UI overlay pixel coordinates. Useful for debugging and visual feedback.

      Parameters

      Returns Position

      2D pixel position (origin top-left)

      const mapper = new CoordinateMapper();
      const worldPos = { x: 0, y: 1.45, z: 0.05 };
      const pixelPos = mapper.world3DToPixel2D(worldPos);
      // pixelPos: { x: 100, y: 50 }

    Properties