How to turn this to mirror BACK to FRONT

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mary Seelye
    New Member
    • Oct 2010
    • 14

    #1

    How to turn this to mirror BACK to FRONT

    This method mirrors FRONT to BACK and now I need it to go BACK to FRONT:

    public void mirrorFrontToBa ck()
    {
    int length = this.getLength( ); //save the length
    int mirrorPoint = length / 2; //mirror around this
    int value = 0; //hold the current value
    //loop from 0 to mirrorPoint
    for (int i=0; i < mirrorPoint; i++) {
    value = this.getSampleV alueAt(i);
    this.setSampleV alueAt(length - 1 - i, value);
    }
    }
  • Oralloy
    Recognized Expert Contributor
    • Jun 2010
    • 988

    #2
    Mary,

    You should be able to use the same code, just run the loop in reverse. If you change the loop to count down from length-1 to mirrorPoint, I think it'll probably do what you need.

    BTW, when you post code in the future, you can use [code]...[/code] tags to make your code a lot more readable.

    There's a whole discussion of tags down this link.

    Good luck with it all.

    Comment

    • Mary Seelye
      New Member
      • Oct 2010
      • 14

      #3
      Ok, I'll try that. Thank you! And thanks for the [code] tag tips, I'm fairly new to this site.

      Comment

      • Oralloy
        Recognized Expert Contributor
        • Jun 2010
        • 988

        #4
        Mary,

        Good luck!

        It's always nice to have some willing ears and suggestions when one gets to a sticking point. The folks here are among the best.

        Cheers!

        Comment

        Working...