0

I am having a laser scanner application where I want to find the difference between two plots ,one the reference plot without object and the other with the object in view.I am plotting the graph with x y coordinates. currently I have plotted the graphs and filled them with different colors so that I can view the subtracted part clearly. But now I want only the difference area to show up...I thought finding the area under the curve will solve the issue.But I think it will only give the numerical value and not the exact position of the subtracted area.

So,I searched the internet looking for solutions in C# where I can do this in the plot itself.Hope I made myself clear. Can someone guide me in the search? I am giving my c# code here..

// PointPairList holds the data for plotting, X and Y arrays (one can use other types of objects as well)

        PointPairList spl1 = new PointPairList(x1, y1);
        PointPairList spl2 = new PointPairList(x2, y2);
        PointPairList spl3 = new PointPairList(x, y);



// Add curves to myPane object
      LineItem myCurve1 = myPane.AddCurve("LIDAR Data Scanner-Measurement-Normal", spl1, Color.Blue, SymbolType.None);
      LineItem myCurve2 = myPane.AddCurve("LIDAR Data Scanner-Measurement-with object", spl2, Color.Red, SymbolType.None);
      LineItem myCurve3 = myPane.AddCurve("LIDAR Data Scanner-Measurement-Subtracted curve", spl3, Color.Green, SymbolType.None);

    //   myCurve1.Line.Width = 3.0F;
    //myCurve2.Line.Width = 3.0F;
    myCurve1.Line.Fill = new Fill(Color.White, Color.FromArgb(16, 155, 0, 0), 90F);
    myCurve2.Line.Fill = new Fill(Color.Black, Color.FromArgb(143, 55, 6, 0), 90F);

I want to display only the rectangle white part in the figure...

enter image description here

ShivShambo
  • 523
  • 12
  • 29
  • Why tag this as c++ and c# when you are only talking about c#? – Aleks Mar 22 '12 at 04:30
  • @Aleks if it is possible in c++,I can do it there also.. – ShivShambo Mar 22 '12 at 04:38
  • What kind of curve do you want to get ? Subtracted curve like this one? http://ars.sciencedirect.com/content/image/1-s2.0-S0304395901002950-gr1.gif – Dmitry Reznik Mar 22 '12 at 05:39
  • @DmitriyReznik Thanks for the suggestion. I have now added the graph in my question. the blue curve is the reference one.. the red one exactly overlaps except at the object position. – ShivShambo Mar 22 '12 at 07:48

1 Answers1

0

I am not sure about data-structures that you are sighted - however, generally speaking, if you are dealing with polygons (closed curves specifies with a set of x,y points) then you can do polygon clipping to find the difference. See

Algorithm to Compute the Remaining Polygon After Subtraction
How to intersect two polygons?

If you can represent your two plots i.e. a reference plot and supplied plot as polygon then above algorithm should allow you compute the difference.

Community
  • 1
  • 1
VinayC
  • 47,395
  • 5
  • 59
  • 72
  • I tried the GPC algorithm. But it is only for the integers. But I have double values.. – ShivShambo Mar 28 '12 at 06:46
  • @lakshmikant, GPC might be using integer coordinates but transform coordinate systems is not that difficult. If you know the range and precision of your values then converting them into/from integers is straight-forward. For example, your doubles are in from say 0 to 10 with 5 digits after decimal the multiplying with 100000 should give you integer values - multiplier can be different for x,y - same to be used when converting ints back to double. – VinayC Mar 28 '12 at 09:44