Пример #1
0
    public void updateWindowsFlushWithEdgeInNeighborDirection(byte[] surfaceHeightsAtEdge, NeighborDirection ndir)
    {
        // ndir is neighb's relation to us
        // so want the windows on the opposite edge
        Direction dir  = NeighborDirectionUtils.DirecionFourForNeighborDirection(NeighborDirectionUtils.oppositeNeighborDirection(ndir));
        Axis      axis = DirectionUtil.AxisForDirection(dir);

        if (axis == Axis.X)
        {
            updateWindowsAlongXEdge(surfaceHeightsAtEdge, DirectionUtil.IsPosDirection(dir));
            return;
        }

        updateWindowsAlongZEdge(surfaceHeightsAtEdge, DirectionUtil.IsPosDirection(dir));
    }
Пример #2
0
//	public List<Window> windowsAdjacentToWindowEitherSide(Window window)
//	{
//		List<Window> xNegWindows = windowsXNegAdjacentToWindow(window);
//		List<Window> xPosWindows = windowsXPosAdjacentToWindow(window);
//		xNegWindows.AddRange(xPosWindows);
//		return xNegWindows;
//	}
//
//	public List<Window> windowsXPosAdjacentToWindow(Window window)
//	{
//		return windowsAdjacentToWindow(window, true);
//	}
//
//	public List<Window> windowsXNegAdjacentToWindow(Window window)
//	{
//		return windowsAdjacentToWindow(window, false);
//	}
//
//	private List<Window> windowsAdjacentToWindow(Window window, bool wantXPos)
//	{
//		return null;
//	}

//	public List<Window> windowsAdjacentToStartOfWindow(Window window)
//	{
//		return windowsAdjacentToEndWindow(window, false);
//	}
//
//	public List<Window> windowsAdjacentToExtentOfWindow(Window window)
//	{
//		return windowsAdjacentToEndWindow(window, true);
//	}
//
//	private List<Window> windowsAdjacentToEndWindow(Window window, bool wantExtent)
//	{
//		return null;
//	}

    #endregion

    #region talk to other windows

    /*
     * 'introduce' (share data with) windows from neighbor noise patches
     *
     */

    public void introduceFlushWindowsWithWindowInNeighborDirection(WindowMap other, NeighborDirection ndir)
    {
        return;

        Direction dir = NeighborDirectionUtils.DirecionFourForNeighborDirection(ndir);

        Axis axis = DirectionUtil.AxisForDirection(dir);

        if (axis == Axis.X)
        {
            introduceFlushWithWindowMapInNeighborDirectionX(other, ndir);
            return;
        }

        introduceFlushWithWindowMapInNeighborDirectionZ(other, ndir);
    }
Пример #3
0
    public Tree sectionOfTreeContainedByNoisePatchNeighborInDirection(NeighborDirection neighborDir)
    {
        if (this.wasNotTruncated())
        {
            return(null);
        }

        PTwo neighborRelOrigin = NeighborDirectionUtils.neighborPatchRelativeCoordForNeighborInDirection(neighborDir, this.nonTruncatedPatchRelativePlot.origin);

        Quad nonTruncNeighPlot = new Quad(neighborRelOrigin, this.undividedDimensions);
        Quad intersection      = Quad.Intersection(nonTruncNeighPlot, new Quad(new PTwo(0, 0), noisePatchXZDims));

        if (intersection.isErsatzNull())
        {
            return(null);
        }

        return(new Tree(neighborRelOrigin, this.y_origin, this.seed, false));
    }
Пример #4
0
    /*
     * Z introductions
     *
     * */
    private void introduceFlushWithWindowMapInNeighborDirectionZ(WindowMap other, NeighborDirection ndir)
    {
        Direction dir    = NeighborDirectionUtils.DirecionFourForNeighborDirection(ndir);
        Direction oppDir = NeighborDirectionUtils.DirecionFourForNeighborDirection(NeighborDirectionUtils.oppositeNeighborDirection(ndir));

        //want windows flush with a given z value (0 or max)
        List <Window>[] thisWinListArrayAtEdge      = this.windowsTouchingEdgeOfNoisePatchNeighborInDirection(dir);
        List <Window>[] winListArrayAtAnEdgeOfOther = other.windowsTouchingEdgeOfNoisePatchNeighborInDirection(oppDir);

        AssertUtil.Assert(thisWinListArrayAtEdge.Length == winListArrayAtAnEdgeOfOther.Length, "confusing. and not what we expected. lists should be the same length");

        bool wantExtentForThis = DirectionUtil.IsPosDirection(dir);

//		this.testSetAllMaxLight(); //TEST
//		other.testSetAllMaxLight();
//
//		return;

        for (int i = 0; i < thisWinListArrayAtEdge.Length; ++i)
        {
            List <Window> wins = thisWinListArrayAtEdge[i];
            foreach (Window win in wins)
            {
                //TEST
//				win.testSetMaxLight(null);
                win.updateWithWindowsFlushWithAnEdge(winListArrayAtAnEdgeOfOther[i], wantExtentForThis);
            }
        }

        for (int i = 0; i < winListArrayAtAnEdgeOfOther.Length; ++i)
        {
            List <Window> wins = winListArrayAtAnEdgeOfOther[i];
            foreach (Window win in wins)
            {
                //TEST
//				win.testSetMaxLight(null);
                win.updateWithWindowsFlushWithAnEdge(thisWinListArrayAtEdge[i], !wantExtentForThis);
            }
        }
    }
Пример #5
0
    /*
     * X AXIS NEIGHBOR INTRODUCTIONS
     *
     */
    private void introduceFlushWithWindowMapInNeighborDirectionX(WindowMap other, NeighborDirection ndir)
    {
        return;         // !!!!

        Direction dir    = NeighborDirectionUtils.DirecionFourForNeighborDirection(ndir);
        Direction oppDir = NeighborDirectionUtils.DirecionFourForNeighborDirection(NeighborDirectionUtils.oppositeNeighborDirection(ndir));

        //want windows along a z on a given x val (0 or max)
        List <Window>[] thisWinListArrayAtEdge      = this.windowsTouchingEdgeOfNoisePatchNeighborInDirection(dir);
        List <Window>[] winListArrayAtAnEdgeOfOther = other.windowsTouchingEdgeOfNoisePatchNeighborInDirection(oppDir);

        if (thisWinListArrayAtEdge.Length == 0 || winListArrayAtAnEdgeOfOther.Length == 0)
        {
            AssertUtil.Assert(false, "??? 0 length arrays");
            return;
        }

        AssertUtil.Assert(thisWinListArrayAtEdge.Length == 1 && winListArrayAtAnEdgeOfOther.Length == 1, "Confusing. dealing with x edge right? length was: " + thisWinListArrayAtEdge.Length);

        foreach (Window win in thisWinListArrayAtEdge[0])        // when world was flat this was null!
        {
//			win.testSetAllValuesTo(4f);
            //TEST
            win.setMaxLight();
//			win.updateWithAdjacentWindowsReturnAddedLightRating(winListArrayAtAnEdgeOfOther[0]);
        }


        foreach (Window othersWin in winListArrayAtAnEdgeOfOther[0])
        {
//			othersWin.testSetAllValuesTo(4f);
            othersWin.setMaxLight();             //TEST

//			othersWin.updateWithAdjacentWindowsReturnAddedLightRating(thisWinListArrayAtEdge[0]);
        }
    }