绘制一个球

根据公式x^2+y^2+z^2=R^2;

令x=RsinAcosB  y=RcosAcosB z=RsinB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Steema.TeeChart;
using Steema.TeeChart.Styles;
using System.Drawing.Drawing2D;
using Steema.TeeChart.Tools; namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private TChart tChart1 = new TChart();
private Surface surfaceSeries1 = new Surface();
private GridBand gridBand = new GridBand();
private Surface surfaceSeries2 = new Surface();
public Form1()
{
InitializeComponent();
Init();
} private void Init()
{
tChart1.Series.Add(surfaceSeries1);
tChart1.Series.Add(surfaceSeries2);
tChart1.Dock = DockStyle.Fill; this.tChart1.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
this.tChart1.Aspect.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; this.tChart1.Axes.Depth.Visible = true;
this.tChart1.Axes.Depth.Labels.ValueFormat = "0.#";
this.tChart1.Axes.Depth.Increment = 0.2;
this.tChart1.Axes.Bottom.Labels.ValueFormat = "0.#";
this.tChart1.Axes.Bottom.Increment = 0.1; this.tChart1.Aspect.Chart3DPercent = ;
this.tChart1.Aspect.Orthogonal = false;
this.tChart1.Aspect.Perspective = ;
this.tChart1.Aspect.Rotation = ;
this.tChart1.Aspect.Elevation = ;
this.tChart1.Aspect.Zoom = ; this.tChart1.Walls.Bottom.Pen.Visible = false;
this.tChart1.Walls.Bottom.Size = ; this.tChart1.Walls.Left.Pen.Visible = false;
this.tChart1.Walls.Left.Size = ;
this.tChart1.Panel.Brush.Color = System.Drawing.Color.FromArgb(((System.Byte)()), ((System.Byte)()), ((System.Byte)()), ((System.Byte)())); Controls.Add(tChart1); InitSurface(surfaceSeries1, Color.Red); InitSurface(surfaceSeries2, Color.Blue); double r = ;
double z = ; List<double> arrayX = new List<double>();
List<double> arrayY = new List<double>();
List<double> arrayZ = new List<double>(); List<double> arrayX1 = new List<double>();
List<double> arrayY1 = new List<double>();
List<double> arrayZ1 = new List<double>(); tChart1.AutoRepaint = false;
try
{
for (double x = -r; x <= r; x += 0.1)
{
for (double y = -r; y <= r; y += 0.1)
{
z = r * r - x * x - y * y;
if (z >= )
{
z = Math.Sqrt(z);
arrayX.Add(x);
arrayY.Add(y);
arrayZ.Add(-z);
}
}
} for (double x = -r; x <= r; x += 0.1)
{
for (double y = -r; y <= r; y += 0.1)
{
z = r * r - x * x - y * y;
if (z >= )
{
z = Math.Sqrt(z);
arrayX1.Add(x);
arrayY1.Add(y);
arrayZ1.Add(z);
}
}
}
surfaceSeries1.Add(arrayX.ToArray(), arrayZ.ToArray(), arrayY.ToArray());//特别需要注意的是,z在中间
surfaceSeries2.Add(arrayX1.ToArray(), arrayZ1.ToArray(), arrayY1.ToArray());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
tChart1.AutoRepaint = true;
tChart1.Refresh();
} private void InitSurface(Surface s, Color color)
{
s.Pen.Color = color;
s.Marks.Symbol.Shadow.Height = ;
s.Marks.Symbol.Shadow.Visible = true;
s.Marks.Symbol.Shadow.Width = ;
s.NumXValues = ;
s.NumZValues = ;
s.PaletteMin = ;
s.PaletteStep = ;
s.UseColorRange = false;
s.UsePalette = true; s.IrregularGrid = true;
s.ShowInLegend = false;
s.UseColorRange = false;
s.UsePalette = true;
s.PaletteStyle = Steema.TeeChart.Styles.PaletteStyles.Strong;
s.PaletteSteps = ;
}
}
}

TeeChart显示三维的图形,使用Surface的更多相关文章

  1. Matlab——图形绘制——三维立体图形 剔透玲珑球 动态图——彗星状轨迹图

    三维绘图函数 三维绘制工具 函数view 实例:三维螺旋线 >> t=:pi/:*pi; plot3(sin(t),cos(t),t) grid %添加网格  plot3可以画出空间中的曲 ...

  2. VS2015编写的MFC上位机,波特率可调,可动态显示曲线,可显示三维

    VS2015编写的MFC上位机,波特率可调,可动态显示曲线,可显示三维 2016年01月14日 11:40:28 博博有个大大大的Dream 阅读数:9375   版权声明:本文为博主原创文章,未经博 ...

  3. 科学计算三维可视化---TVTK入门(创建和显示三维对象)

    一:创建一个基本的三维对象 (一)长方体操作 traits:就是TVTK对象的属性 (1)对象属性操作 >>> from tvtk.api import tvtk >>& ...

  4. Cocos2d 利用继承Draw方法制作可显示三维数据(宠物三维等)的三角形显示面板

    很久没有写博客了,这段时间比较忙,又是搬家又是做自己的项目,还有太多琐碎的事情缠身,好不容易抽出时间把最近自己做的一些简单例子记录一下. 在我的项目中,我需要一个显示面板来显示游戏中的一个三维数据,例 ...

  5. 使用Xming显示Oracle Linux图形界面

    如果你在尝试各种官方说明文档中的方法之后,xclock仍然无法远程显示. 系统 Win10 - Oracle Linux 7.5 Xming的文档以及网上教程都说的是Xming相关的配置 但是,要显示 ...

  6. [Swift]LeetCode892. 三维形体的表面积 | Surface Area of 3D Shapes

    On a N * N grid, we place some 1 * 1 * 1 cubes. Each value v = grid[i][j] represents a tower of v cu ...

  7. VS+OpenGl 显示三维STL模型 代码

    今天调出了用VS环境结合OpenGL glut工具包进行显示STL模型的模块,进行了渲染.效果: 如下,后期会进行进一步优化,先贴上: #ifndef DATA_H #define DATA_H st ...

  8. autoCAD绘制简单三维立体图形

    第一步: 首先绘制一个简单的(封闭的)二维图形: 第二步: 变换观察视角,比如修改为 变换后的视角: 第三步: 选中闭合图形边框,使用组合键"ctrl + shift + E",然 ...

  9. origin显示三维曲面

    准备数据并选中数据: 这里如果只关心z<1部分的趋势,可以对Z轴范围进行调整,双击Z轴的数字: 然后修改显色条的范围,双击曲面: 最后让曲面最上面部分clip掉: 成功了:

随机推荐

  1. Linux C 文件与目录1 创建目录

    linux C    创建目录 创建目录函数:mkdir 函数原型:int mkdir(char * pathname , mode_t mode); pathname字符指针是表示需要创建的目录路径 ...

  2. 如何在64位的Windows中安裝PLSQLDEVELOPER 8

    先到 Oracle 官網下載Oracle Database 11g Release 2 Client (11.2.0.1.0) for Microsoft Windows (x64) ,接者依照以下步 ...

  3. 屏蔽ios7中某个页面的默认手势滑回返回

    - (void)viewWillDisappear:(BOOL)animated {[super viewWillDisappear:YES];self.navigationController.in ...

  4. usb口外接了Com设备,U盘识别不了问题

    就如本题,当我usb口外接了Com设备时候,再插入U盘会出现识别不了的问题. 解决方法非常的简单,只要拨出这个com设备的usb就可以使用U盘了^_^

  5. Http之Get/Post请求区别

    Http之Get/Post请求区别 1.HTTP请求格式: <request line> <headers> <blank line> [<request-b ...

  6. 3640: JC的小苹果 - BZOJ

    让我们继续JC和DZY的故事.“你是我的小丫小苹果,怎么爱你都不嫌多!”“点亮我生命的火,火火火火火!”话说JC历经艰辛来到了城市B,但是由于他的疏忽DZY偷走了他的小苹果!没有小苹果怎么听歌!他发现 ...

  7. [设计模式] 13 责任链模式 Chain of Responsibility

    转    http://blog.csdn.net/wuzhekai1985   http://www.jellythink.com/archives/878 向项目经理提交了休假申请,我的项目经理向 ...

  8. 用NPOI导出Excel

    用NPOI导出Excel public void ProcessRequest(HttpContext context) { context.Response.ContentType = " ...

  9. DataGrid行详细信息的绑定--DataGrid.RowDetailsTe(转载)

    在Silverlight中的DataGrid控件使用中我们想点击其中一行并且看这一行的详细信息应该如何做呢?而且这个详细信息是多行的数据,而非简单的几个属性. 在这里我们使用DataGrid.RowD ...

  10. Javascript操作元素属性方法总结

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...