@@ -250,6 +250,16 @@ export function allRotationsAndReflections(
250250 const includeReflections = options ?. includeReflections ?? true ;
251251 const normalize = options ?. normalize ?? "none" ;
252252
253+ // Check for duplicate points
254+ const seenPoints = new Set < string > ( ) ;
255+ for ( const { dx, dy } of deltas ) {
256+ const key = `${ dx } ,${ dy } ` ;
257+ if ( seenPoints . has ( key ) ) {
258+ throw new Error ( `Input contains duplicate points: ${ key } ` ) ;
259+ }
260+ seenPoints . add ( key ) ;
261+ }
262+
253263 // ---- D4 transforms on the (dx,dy) portion only; pc is retained
254264 const rot90 = ( d : Delta ) : Delta => ( { dx : - d . dy , dy : d . dx , payload : d . payload } ) ;
255265 const rot180 = ( d : Delta ) : Delta => ( { dx : - d . dx , dy : - d . dy , payload : d . payload } ) ;
@@ -279,7 +289,7 @@ export function allRotationsAndReflections(
279289 } ;
280290
281291 // ---- Stable key for dedupe (includes pc to avoid collapsing different labeled shapes)
282- // Sort by dx, dy, pc so that order in input doesn't matter.
292+ // Sort by dx, dy so that order in input doesn't matter.
283293 const keyOf = ( ds : Delta [ ] ) : string => {
284294 const sorted = [ ...ds ] . sort ( ( a , b ) =>
285295 ( a . dx - b . dx ) || ( a . dy - b . dy )
0 commit comments