public static bool GetPoints(FileStream file, int cksize, ref lwPointList point, ref int flen) { byte[] f = new byte[cksize]; int np; if (cksize == 1) return true; /* extend the point array to hold the new points */ np = cksize / 12; point.offset = point.count; point.count += np; point.pt = new lwPoint[point.count]; /* read the whole chunk */ flen += file.Read(f, 0, cksize); lwio.revbytes(ref f, 4, np * 3); /* assign position values */ for (int i = 0, j = 0; i < np; i++, j += 3) { point.pt[i].pos = new float[3]; point.pt[i].pos[0] = BitConverter.ToSingle(f, j * 4); point.pt[i].pos[1] = BitConverter.ToSingle(f, (j + 1) * 4); point.pt[i].pos[2] = BitConverter.ToSingle(f, (j + 2) * 4); } return true; }
public static bool GetPoints(FileStream file, int cksize, ref lwPointList point, ref int flen) { byte[] f = new byte[cksize]; int np; if (cksize == 1) { return(true); } /* extend the point array to hold the new points */ np = cksize / 12; point.offset = point.count; point.count += np; point.pt = new lwPoint[point.count]; /* read the whole chunk */ flen += file.Read(f, 0, cksize); lwio.revbytes(ref f, 4, np * 3); /* assign position values */ for (int i = 0, j = 0; i < np; i++, j += 3) { point.pt[i].pos = new float[3]; point.pt[i].pos[0] = BitConverter.ToSingle(f, j * 4); point.pt[i].pos[1] = BitConverter.ToSingle(f, (j + 1) * 4); point.pt[i].pos[2] = BitConverter.ToSingle(f, (j + 2) * 4); } return(true); }