Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | 3132x 58x 58x 58x 58x 58x 964x 58x 3x 1x 1x 1x 58x | /**
* Korean Guard Positions (막기자세)
*
* Defines authentic Korean martial arts guard positions for all animations.
* Guards protect vital areas and provide optimal positioning for techniques.
*
* Korean martial arts emphasize three primary guard levels:
* - 상단막기 (Sangdan Makgi) - High guard protecting head
* - 중단막기 (Jungdan Makgi) - Middle guard protecting torso
* - 하단막기 (Hadan Makgi) - Low guard protecting lower body
*
* Each guard position includes:
* - Proper shoulder and elbow angles
* - Hand pose (주먹쥐기 - fist formation)
* - Guard height description
* - Korean/English terminology
*
* @module systems/animation/KoreanGuardPositions
* @category Animation System
* @korean 막기자세시스템
*/
/**
* Guard position for a single arm
* @korean 팔방어위치
*/
export interface GuardArmPosition {
/** Shoulder rotation in radians (x, y, z) */
readonly shoulder: readonly [number, number, number];
/** Elbow rotation in radians (x, y, z) */
readonly elbow: readonly [number, number, number];
/** Wrist rotation in radians (x, y, z) */
readonly wrist: readonly [number, number, number];
}
/**
* Complete guard position configuration
* @korean 방어자세설정
*/
export interface GuardPosition {
/** Korean name */
readonly korean: string;
/** English name */
readonly english: string;
/** Romanization */
readonly romanized: string;
/** Description of guard purpose and application */
readonly description: {
readonly korean: string;
readonly english: string;
};
/** Left arm guard position */
readonly left: GuardArmPosition;
/** Right arm guard position */
readonly right: GuardArmPosition;
/** Height level of guard */
readonly height: "temple_level" | "chest_level" | "abdomen_level";
/**
* Default hand pose description for this guard.
*
* NOTE: This field is documentation/metadata only and is not wired into the
* hand pose system or the HandPoseType enum. Actual hand poses are applied
* directly in animation code (e.g., via HAND_POSES.FIST). Do not use these
* string literal values for programmatic logic.
*
* @see HandPoseType for the actual hand pose enum values
* @see HAND_POSES for applying hand poses in animations
*/
readonly handPose: "fist_vertical" | "fist_horizontal" | "open_hand";
/** Vital areas protected by this guard */
readonly protects: readonly string[];
}
/**
* Helper to convert degrees to radians
* @param degrees - Angle in degrees
* @returns Angle in radians
* @korean 도를라디안으로
*/
const toRadians = (degrees: number): number => (degrees * Math.PI) / 180;
/**
* 상단막기 (Sangdan Makgi) - High Guard
*
* Traditional Taekwondo high block position protecting head and face.
* Both hands at temple/forehead level with elbows bent tight.
* Fists vertical (thumb-side up) for maximum protection.
*
* Protects against:
* - High strikes to head (머리 공격)
* - Overhead attacks (위쪽 공격)
* - Face punches (얼굴 주먹)
*
* Application:
* - Default guard for Geon (Heaven) stance
* - Used in high kicking techniques
* - Transitional guard for head-level attacks
*
* Biomechanics:
* - Shoulders raised (~15° abduction)
* - Elbows bent ~110° (tight guard)
* - Fists at temple level
* - Forearms vertical for deflection
*
* @korean 상단막기자세
*/
export const HIGH_GUARD: GuardPosition = {
korean: "상단막기",
english: "High Guard",
romanized: "Sangdan Makgi",
description: {
korean:
"머리와 얼굴을 보호하는 높은 방어 자세. 주먹을 관자놀이 높이에 두고 팔꿈치를 단단히 구부림.",
english:
"High guard protecting head and face. Fists at temple level with elbows bent tight.",
},
left: {
shoulder: [toRadians(-15), toRadians(0), toRadians(10)] as const,
elbow: [toRadians(0), toRadians(0), toRadians(-110)] as const,
wrist: [toRadians(0), toRadians(0), toRadians(0)] as const,
},
right: {
shoulder: [toRadians(-15), toRadians(0), toRadians(-10)] as const,
elbow: [toRadians(0), toRadians(0), toRadians(110)] as const,
wrist: [toRadians(0), toRadians(0), toRadians(0)] as const,
},
height: "temple_level",
handPose: "fist_vertical",
protects: [
"head",
"temple",
"forehead",
"eyes",
"nose",
"jaw",
] as const,
};
/**
* 중단막기 (Jungdan Makgi) - Middle Guard
*
* Standard Korean martial arts guard at chest/solar plexus level.
* Most versatile guard position, used in most fighting stances.
* Elbows at 90° protecting ribs and torso.
*
* Protects against:
* - Body punches (몸통 주먹)
* - Solar plexus strikes (명치 공격)
* - Rib attacks (갈비뼈 공격)
* - Liver strikes (간 공격)
*
* Application:
* - Default guard for most stances
* - Starting position for most techniques
* - Balanced offensive/defensive posture
*
* Biomechanics:
* - Shoulders neutral (~10° forward)
* - Elbows bent ~90° (classic guard)
* - Fists at chest/chin level
* - Ready to attack or defend
*
* @korean 중단막기자세
*/
export const MIDDLE_GUARD: GuardPosition = {
korean: "중단막기",
english: "Middle Guard",
romanized: "Jungdan Makgi",
description: {
korean:
"가슴과 명치를 보호하는 중간 방어 자세. 팔꿈치를 90도 구부려 몸통을 보호함.",
english:
"Middle guard protecting chest and solar plexus. Elbows bent at 90° protecting torso.",
},
left: {
shoulder: [toRadians(-10), toRadians(0), toRadians(8)] as const,
elbow: [toRadians(0), toRadians(0), toRadians(-90)] as const,
wrist: [toRadians(0), toRadians(0), toRadians(0)] as const,
},
right: {
shoulder: [toRadians(-10), toRadians(0), toRadians(-8)] as const,
elbow: [toRadians(0), toRadians(0), toRadians(90)] as const,
wrist: [toRadians(0), toRadians(0), toRadians(0)] as const,
},
height: "chest_level",
handPose: "fist_vertical",
protects: [
"chest",
"solar_plexus",
"ribs",
"liver",
"spleen",
"heart",
] as const,
};
/**
* 하단막기 (Hadan Makgi) - Low Guard
*
* Low guard position protecting lower body and groin.
* Used in grappling and ground-fighting scenarios.
* Hands at abdomen/hip level ready for low attacks.
*
* Protects against:
* - Low kicks (낮은 발차기)
* - Body kicks (몸통 발차기)
* - Groin attacks (낭심 공격)
* - Takedown attempts (넘어뜨리기)
*
* Application:
* - Default for Gon (Earth) stance
* - Grappling and clinch range
* - Defense against low attacks
*
* Biomechanics:
* - Shoulders forward (~20° flexion)
* - Elbows bent ~70° (wider guard)
* - Fists at abdomen/hip level
* - Ready to sprawl or clinch
*
* @korean 하단막기자세
*/
export const LOW_GUARD: GuardPosition = {
korean: "하단막기",
english: "Low Guard",
romanized: "Hadan Makgi",
description: {
korean:
"하복부와 낭심을 보호하는 낮은 방어 자세. 손을 배 높이에 두고 낮은 공격에 대비함.",
english:
"Low guard protecting lower body and groin. Hands at abdomen level ready for low attacks.",
},
left: {
shoulder: [toRadians(20), toRadians(0), toRadians(10)] as const,
elbow: [toRadians(0), toRadians(0), toRadians(-70)] as const,
wrist: [toRadians(0), toRadians(0), toRadians(0)] as const,
},
right: {
shoulder: [toRadians(20), toRadians(0), toRadians(-10)] as const,
elbow: [toRadians(0), toRadians(0), toRadians(70)] as const,
wrist: [toRadians(0), toRadians(0), toRadians(0)] as const,
},
height: "abdomen_level",
handPose: "fist_vertical",
protects: [
"abdomen",
"groin",
"hip",
"thigh",
"lower_ribs",
] as const,
};
/**
* All Korean guard positions indexed by name
* @korean 모든방어자세
*/
export const KOREAN_GUARD_POSITIONS = {
HIGH_GUARD,
MIDDLE_GUARD,
LOW_GUARD,
} as const;
/**
* Guard position type
* @korean 방어자세타입
*/
export type GuardPositionType = keyof typeof KOREAN_GUARD_POSITIONS;
/**
* Get guard position by type
*
* @param type - Guard position type
* @returns Guard position configuration
* @korean 방어자세가져오기
*/
export const getGuardPosition = (type: GuardPositionType): GuardPosition => {
return KOREAN_GUARD_POSITIONS[type];
};
/**
* Get appropriate guard for stance height
*
* Determines which guard position is most appropriate based on
* the stance configuration and fighting context.
*
* @param stanceType - Type of stance ("high" | "middle" | "low")
* @returns Recommended guard position
* @korean 자세높이에맞는방어자세
*/
export const getGuardForStanceHeight = (
stanceType: "high" | "middle" | "low"
): GuardPosition => {
switch (stanceType) {
case "high":
return HIGH_GUARD;
case "low":
return LOW_GUARD;
case "middle":
default:
return MIDDLE_GUARD;
}
};
/**
* Apply guard position to KeyframeConfig
*
* Applies a Korean martial arts guard position to a keyframe configuration.
* Can apply to one hand (for techniques where one hand strikes) or both hands.
*
* Usage:
* ```typescript
* const kf = new KeyframeConfig(0.0);
* applyGuardPositionToConfig(kf, MIDDLE_GUARD, "both"); // Both hands in guard
* applyGuardPositionToConfig(kf, MIDDLE_GUARD, "left"); // Only left hand guards
* ```
*
* @param config - KeyframeConfig to apply guard to
* @param guardPosition - Guard position configuration
* @param hand - Which hand(s) to apply ("left" | "right" | "both")
* @korean KeyframeConfig에방어자세적용
*/
export const applyGuardPositionToConfig = (
config: any, // Will be typed as KeyframeConfig in implementation
guardPosition: GuardPosition,
hand: "left" | "right" | "both" = "both"
): void => {
// Apply left hand guard
if (hand === "left" || hand === "both") {
config.rotate(
"SHOULDER_L" as any,
guardPosition.left.shoulder[0],
guardPosition.left.shoulder[1],
guardPosition.left.shoulder[2]
);
config.rotate(
"ELBOW_L" as any,
guardPosition.left.elbow[0],
guardPosition.left.elbow[1],
guardPosition.left.elbow[2]
);
config.rotate(
"WRIST_L" as any,
guardPosition.left.wrist[0],
guardPosition.left.wrist[1],
guardPosition.left.wrist[2]
);
}
// Apply right hand guard
if (hand === "right" || hand === "both") {
config.rotate(
"SHOULDER_R" as any,
guardPosition.right.shoulder[0],
guardPosition.right.shoulder[1],
guardPosition.right.shoulder[2]
);
config.rotate(
"ELBOW_R" as any,
guardPosition.right.elbow[0],
guardPosition.right.elbow[1],
guardPosition.right.elbow[2]
);
config.rotate(
"WRIST_R" as any,
guardPosition.right.wrist[0],
guardPosition.right.wrist[1],
guardPosition.right.wrist[2]
);
}
};
|