import type { Fn } from "@thi.ng/api" ; import type { PCLike , PCLikeConstructor } from "@thi.ng/geom-api" ; import type { MatOpMV , ReadonlyMat } from "@thi.ng/matrices" ; import { mulV , mulV344 } from "@thi.ng/matrices/mulv" ; import type { ReadonlyVec } from "@thi.ng/vectors" ; import { __copyAttribs } from "./copy.js" ; export const __transformPoints = ( pts , mat , op = mulV ) => ( pts . forEach ( ( p ) => op ( null , mat , p ) ) , pts ) ; export const __transformedPoints = ( pts , mat , op = mulV ) => pts . map ( ( p ) => op ( [ ] , mat , p ) ) ; export const __transformPointsWith = ( pts , fn , op = mulV ) => ( pts . forEach ( ( p ) => op ( null , fn ( p ) , p ) ! ) , pts ) ; export const __transformedPointsWith = ( pts , fn , op = mulV ) => pts . map ( ( p ) => op ( [ ] , fn ( p ) , p ) ! ) ; export const __transformedShape = ( ctor ) => ( $ , mat ) => new ctor ( __transformedPoints ( $ . points , mat ) , __copyAttribs ( $ ) ) ; export const __transformedShapePoints = ( ctor ) => ( $ , fn ) => new ctor ( __transformedPointsWith ( $ . points , fn ) , __copyAttribs ( $ ) ) ; export const __transformPoints3 = ( pts , mat ) => __transformPoints ( pts , mat , < any > mulV344 ) ; export const __transformedPoints3 = ( pts , mat ) => __transformedPoints ( pts , mat , < any > mulV344 ) ; export const __transformedPointsWith3 = ( pts , fn ) => __transformedPointsWith ( pts , fn , < any > mulV344 ) ; export const __transformedShape3 = ( ctor ) => ( $ , mat ) => new ctor ( __transformedPoints3 ( $ . points , mat ) , __copyAttribs ( $ ) ) ; export const __transformedShapePoints3 = ( ctor ) => ( $ , fn ) => new ctor ( __transformedPointsWith3 ( $ . points , fn ) , __copyAttribs ( $ ) ) ;