void srcPointToCmVectorFromTargetPointCSLinux(double src_space_point_x, double src_space_point_y, double cm_target_point_x, double cm_target_point_y, int len, [In] double[] pointsSrcSpaceFlat, [In] double[] pointsDstSpaceFlat, [In, Out, MarshalAs(UnmanagedType.LPStruct)] DumPoint2d ret);
// Returns the vector pointing from cmTargetPoint to srcSpacePoint in cm with positive meaning up. public static Point2d SrcPointToCmVectorFromTargetPoint(Point2d srcSpacePoint, Point2d cmTargetPoint, Point2d[] pointsSrcSpace, Point2d[] pointsCmSpace) { if (pointsSrcSpace.Length != pointsCmSpace.Length) { throw new ArgumentException("pointsSrcSpace.Length != pointsDstSpace.Length", "pointsDstSpace.Length"); } double[] pointsSrcSpaceFlat = new double[pointsSrcSpace.Length * 2]; double[] pointsDstSpaceFlat = new double[pointsCmSpace.Length * 2]; int fi = 0; for (int pi = 0; pi < pointsSrcSpace.Length; ++pi) { pointsSrcSpaceFlat[fi] = pointsSrcSpace[pi].x; pointsDstSpaceFlat[fi] = pointsCmSpace[pi].x; ++fi; pointsSrcSpaceFlat[fi] = pointsSrcSpace[pi].y; pointsDstSpaceFlat[fi] = pointsCmSpace[pi].y; ++fi; } DumPoint2d ret = new DumPoint2d(); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { srcPointToCmVectorFromTargetPointCSWin(srcSpacePoint.x, srcSpacePoint.y, cmTargetPoint.x, cmTargetPoint.y, pointsSrcSpace.Length, pointsSrcSpaceFlat, pointsDstSpaceFlat, ret); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { srcPointToCmVectorFromTargetPointCSLinux(srcSpacePoint.x, srcSpacePoint.y, cmTargetPoint.x, cmTargetPoint.y, pointsSrcSpace.Length, pointsSrcSpaceFlat, pointsDstSpaceFlat, ret); } else { throw new System.PlatformNotSupportedException(); } return(new Point2d(ret.x, ret.y)); }
private static extern void pointBaseChangeCSLinux(double x, double y, int len, [In] double[] pointsSrcSpaceFlat, [In] double[] pointsDstSpaceFlat, [In, Out, MarshalAs(UnmanagedType.LPStruct)] DumPoint2d ret);