Home > Coding Helpers > Code providers for working in two-dimensional space

Code providers for working in two-dimensional space

September 4th, 2012

There are two code providers that are useful when you have written the code to work in one dimension, but if you want to create a similar code to work in a two-dimensional space, here is an example:

CodeRush Rotate 90 Degrees code sample

The code is working with rows of a grid and draws the background for them. Consider working with columns instead. Here is what the Rotate 90 Degrees code provider will produce:

CodeRush Rotate 90 Degrees preview

The code provider modifies the code working in two-dimensional coordinate space, so it operates at a 90-degree shift. In other words, it changes the corresponding properties into neighborhood properties, such as:

  • X -> Y, Y -> X;
  • Height -> Width, Width -> Height;
  • Horizontal -> Vertical, Vertical -> Horizontal;
  • Left -> Top, Top -> Left, Right -> Bottom, Bottom -> Right;
  • Column->Row, Row-> Column, Rows->Columns, Columns->Rows.

The Mirror Code code provider, in its turn, modifies the code working in two-dimensional coordinate space, so it operates at a 180-degree shift:

CodeRush Mirror Code preview

The code providers changes + to -, ++ to — as well as – to + and — to ++. It also converts Left to Right, Top to Bottom the same way as the Rotate 90 Degrees code provider does.

—–
Products: CodeRush Pro
Versions: 12.1 and up
VS IDEs: 2008 and up
Updated: Sep/04/2012
ID: C183

Similar Posts:

  1. No comments yet. Be the first and leave a comment!