protected override void CreatePiecePositionTable() { PiecePositions = new PiecePositionsType[GetMaxIndex()]; int max_ring = GetMaxRingIndex(); for (int i = 1, m = 0; i <= max_ring; i++) { int max_intra_ring = GetMaxIntraRingIndexAt(i); for (int j = 1; j <= max_intra_ring; j++, m++) { Healpix.HealpixIndex idx = new Healpix.HealpixIndex() { i = i, j = j }; Healpix.HealpixPolarCoord polar = pixelization.GetSphCoord(idx); Point3D point = pixelization.GetCartesianCoord(polar); PiecePositions[m] = new PiecePositionsType() { index = idx, position_polar = polar, position_cart = new Vector3D() { X = point.X, Y = point.Y, Z = point.Z } }; } } }
protected override void CreatePiecePositionTable() { PiecePositions = new PiecePositionsType[GetMaxIndex()]; int max_ring = GetMaxRingIndex(); for (int i = 1, m = 0; i <= max_ring; i++) { int max_intra_ring = GetMaxIntraRingIndexAt(i); if (max_intra_ring == 1) { PiecePositions[m++] = new PiecePositionsType() { index = new Healpix.HealpixIndex() { i = i, j = 1 }, position_polar = new Healpix.HealpixPolarCoord() { phi = 0, theta = (i == 1) ? 0 : Math.PI }, position_cart = new Vector3D() { X = 0, Y = 0, Z = (i == 1) ? 1 : -1 } }; continue; } for (int j = 1; j <= max_intra_ring; j++, m++) { Healpix.HealpixIndex idx = new Healpix.HealpixIndex() { i = i, j = j }; Healpix.HealpixIndex idx_act = new Healpix.HealpixIndex() { i = i - 1, j = j - 0.5 }; Healpix.HealpixPolarCoord polar = pixelization.GetSphCoord(idx_act); Point3D point = pixelization.GetCartesianCoord(polar); PiecePositions[m] = new PiecePositionsType() { index = idx, position_polar = polar, position_cart = new Vector3D() { X = point.X, Y = point.Y, Z = point.Z } }; } } }
public virtual void SetCursorCoordinates(double theta, double phi) // slow version (all search) { Point3D point = pixelization.GetCartesianCoord(new Healpix.HealpixPolarCoord() { theta = theta, phi = phi }); Healpix.HealpixIndex idx = GetNearestPiece(new Vector3D() { X = point.X, Y = point.Y, Z = point.Z }); cursor_idx_i = (int)idx.i; cursor_idx_j = (int)idx.j; }
public override void SetCursorCoordinates(double theta, double phi) { Healpix.HealpixPolarCoord polar = new Healpix.HealpixPolarCoord() { theta = theta, phi = phi }; Healpix.HealpixIndex index = pixelization.GetHealpixIndex(polar); int base_idx_i = (int)(index.i + 1 + 0.5); int begin_idx_i = (base_idx_i <= 1) ? 1 : base_idx_i - 1; int end_idx_i = (base_idx_i >= GetMaxRingIndex()) ? GetMaxRingIndex() : base_idx_i + 1; Point3D point = pixelization.GetCartesianCoord(polar); Healpix.HealpixIndex idx = GetNearestPiece(new Vector3D() { X = point.X, Y = point.Y, Z = point.Z }, begin_idx_i, end_idx_i); cursor_idx_i = (int)idx.i; cursor_idx_j = (int)idx.j; }
public virtual void SetCursorCoordinates(Healpix.HealpixIndex idx) { cursor_idx_i = (int)idx.i; cursor_idx_j = (int)idx.j; }