绘制一个球

根据公式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. Team Homework #1 学长“学霸英语学习软件”试用

    简介: 一款英语单词记忆和管理辅助软件. 基本功能: 内置GRE词汇及其常考形态.Webster英语解释 单词发音功能 单词测验模式 简易词典功能 基本界面 词库单词读取 单词测试 优点: 1.界面简 ...

  2. ifame 跨域高度自适应

    代码如下:var iframeids = ['memberIndexIframe','inquiryCenterIframe','everychinaBbsIframe']; var iframehi ...

  3. bnuoj 4208 Bubble sort

    http://www.bnuoj.com/bnuoj/problem_show.php?pid=4208 [题意]:如题,求冒泡排序遍历趟数 [题解]:这题开始2B了,先模拟TLE,然后想了一下,能不 ...

  4. android support Percent支持库开发

    Android的布局支持百分比的设置进行开发,来学习如何去实现它,不过看起来会像网页的设置,比如宽度的设置属性是`layout_widthPercent`.在此之前,我们一般都会设置Linearlay ...

  5. Understand User's Intent from Speech and Text

    http://research.microsoft.com/en-us/projects/IntentUnderstanding/ Understanding what users like to d ...

  6. 2463: [中山市选2009]谁能赢呢?- BZOJ

    Description小明和小红经常玩一个博弈游戏.给定一个n×n的棋盘,一个石头被放在棋盘的左上角.他们轮流移动石头.每一回合,选手只能把石头向上,下,左,右四个方向移动一格,并且要求移动到的格子之 ...

  7. 3044 矩形面积求并 - Wikioi

    题目描述 Description 输入n个矩形,求他们总共占地面积(也就是求一下面积的并) 输入描述 Input Description 可能有多组数据,读到n=0为止(不超过15组) 每组数据第一行 ...

  8. 找不到对应的webservice配置参数[ProcessService]

    在UI端 保存时 界面显示无法保存 且报此错误 “找不到对应的webservice配置参数[ProcessService]” 此下为解决方法: 首先 在[应用管理平台]--[参数模板设置] 找到你的参 ...

  9. unity与Android相互调用

    原地址:http://www.cnblogs.com/ayanmw/p/3727782.html 现在unity 导出的android客户端需要调用 Android 的支付SDK,但是unity与an ...

  10. How to Enable 64-bit Processes for Enhanced Protected Mode in Internet Explorer 11 (IE11)

       Information Enhanced Protected Mode (EPM) adds additional security to Protected Mode and includes ...