Tsurface contour effect

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
reosc
Newbie
Newbie
Posts: 3
Joined: Mon Dec 02, 2013 12:00 am

Tsurface contour effect

Post by reosc » Mon Apr 28, 2014 9:04 am

Hello,

I want to draw a round surface with a hole inside.
The result is not what I expect. There are side effects at the contour.
Is there a way to remove these drawings not very nice and which are not par tof the real surface ?

Image

I joined an example code.
It runs under Delphi XE2 VCL and teechart 2013

Thanks in advance.

Nicolas
Attachments
TeeChartTest.7z
(61.53 KiB) Downloaded 330 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Tsurface contour effect

Post by Yeray » Mon Apr 28, 2014 1:49 pm

Hello Nicolas,

I'm not sure if this is what you where looking for but if I comment the last AddXYZ call in your code, I get this:
2014-04-28_1546.png
2014-04-28_1546.png (181.55 KiB) Viewed 4537 times

Code: Select all

  n := 10;
  Series1.Clear;
  for i := -n to n do
  begin
    for j := -n to n do
    begin
      r := sqrt(sqr(i)+sqr(j));
      if (r<=n) then
      begin
        if (r>4) then
        begin
         Series1.AddXYZ(i, Cos(2*pi*r/n), j);
        end else
         Series1.AddXYZ(i, 0, j, '', clNone);
      end else
//         Series1.AddXYZ(i, 0, j, '', clNone);
    end;
  end;
If this is not what you where trying to draw, please try to highlight what exact polygons you find to be not expected given the data you've entered.
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

reosc
Newbie
Newbie
Posts: 3
Joined: Mon Dec 02, 2013 12:00 am

Re: Tsurface contour effect

Post by reosc » Tue Apr 29, 2014 9:23 am

Hello,

Thank you for your answer, it's what I want to get. I want too that the contour of the hole inside has not this effect.
HoleEffect.png
HoleEffect.png (137.6 KiB) Viewed 4522 times
I tried your correction, but I've got a violation access (I just comment the last AddXYZ line).
Maybe I have a wrong installation because if I don't fill all the points of the series (it means 10x10 points), I have this access violation.
First I've just wanted to add points where the data are valid.
ViolationAccess.png
ViolationAccess.png (21.52 KiB) Viewed 4526 times
I think it should be possible to fill the series with any number of points. So I don't understand this behavior.
My goal is to draw a surface in which there are holes with any number of points.

Nicolas

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Tsurface contour effect

Post by Yeray » Tue Apr 29, 2014 10:38 am

Hi Nicolas,

If I remove another line I get this:
2014-04-29_1232.png
2014-04-29_1232.png (152.13 KiB) Viewed 4510 times
Here is the code I have:

Code: Select all

procedure TForm2.BDisplayClick(Sender: TObject);
var i, j : integer;
    n : integer;
    r : double;
begin
  n := 10;
  Series1.Clear;
  for i := -n to n do
  begin
    for j := -n to n do
    begin
      r := sqrt(sqr(i)+sqr(j));
      if (r<=n) then
      begin
        if (r>4) then
        begin
         Series1.AddXYZ(i, Cos(2*pi*r/n), j);
        end; {else
         Series1.AddXYZ(i, 0, j, '', clNone);}
      end; {else
         Series1.AddXYZ(i, 0, j, '', clNone);}
    end;
  end;
end;
And here the complete project:
TeeChartTest.zip
(1.95 KiB) Downloaded 312 times
Maybe you are not using the latest TeeChart version, are you?
What IDE are you using?

You could also try setting IrregularGrid to true. See this for more info on how to populate this kind of series.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

reosc
Newbie
Newbie
Posts: 3
Joined: Mon Dec 02, 2013 12:00 am

Re: Tsurface contour effect

Post by reosc » Tue Apr 29, 2014 11:22 am

Hello,

I was using Delphi XE2 with Teechart VCL 2013.
I installed the new version 2014 of Teechart for XE2 and it solved my issue of violation access.

Now I will try to customize my drawing by removing the line and by smoothing the colors between cells.

Thank you for your answers.

Best regards

Nicolas

Post Reply