Hello everyone,
I am confuse to what my professor is asking for Part 4 of our project.
--> The fourth method for you to develop must manipulate the Colors within a given box. To compute how much manipulation to do on a Pixel from its LOCATION (x,y), the function defined by the method below

public static double normalizedValue (double num, double rangeMin, double rangeMax)
{
 return(num / (rangeMax - rangeMin);
 }

For example the coordinate x varies between the values xMin and xMax parameters given by the caller. It is useful to have a number in the 0.0 to 1.0 range, computed from x. That useful number will be computed and returned when you program the expression normalizedValue(x, xMin, xMax)

public static double distance (int x1, int y1, int x2, int y2)
 {
  double x1d = (double) x1;
  double x2d = (double) x2;
  double y1d = (double) y1;
  double y2d = (double) y2;
  return Math.sqrt((x2d-x1d)*(x2d-x1d) + (y2d - y1d)*(y2d - y1d)));
  } <--- Can someone explain this piece of code to me, my professor explanation confused me. 

I am confuse about the pieces of code.

Do you understand the closest distance equation between 2 points on 2D? It is...

distance = square root of ( (x2-x1)^2 + (y2-y1)^2 )

The distance() method is done exactly what the equation is. When you do normalization, you are converting a vector it its unit vector (magnitude of 1). So you need to compute the current magnitude (distance) in order to convert it to a unit vector for other uses. I am not sure what program you are doing because it can be any thing (rotate, transform, ray, etc.).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.