当前位置:首页 » 编程语言 » c语言绘图坐标换算
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

c语言绘图坐标换算

发布时间: 2022-06-06 03:54:51

Ⅰ 平面直角坐标向经纬度坐标转换公式,我要用c语言写程序,急需~~

什么意思?说清楚???

Ⅱ 怎样用C语言实现天球坐标系与直角坐标系之间的转换,用编程实现。求大神指导,非常感谢

#include <stdio.h>
#include <math.h>
int main()
{
//输入格式:α,β,r β是纵轴的夹角
double angle_a,angle_b;
double radin;
double x,y,z;

scanf("%lf%lf%lf",&angle_a,&angle_b,&radin);

x = radin*cos(angle_a);
y = radin*sin(angle_a);
z = radin*cos(angle_b);

printf("%lf\t%lf\t%lf\t",x,y,z);
return 0;
}

Ⅲ 用C语言或者C++实现大地坐标系与大地空间直角坐标系的转换

当球心在z=1点时,r和上面的不一样。此时r^2=R^2+2rcos(PHI)-1r^2-2rcos(PHI)=R^2-1[r-cos(PHI)]^2=R^2-1+[cos(PHI)]^2然后开根号 得到r与R和PHI的关系式。因为r是表示球面上的点到坐标原点的距离,所以当球心改变时,距离表达式一定不一样。

Ⅳ c语言编出的图形如直线是以左上角为(0,0)点如何调整成符合习惯的坐标系

c语言本身是无法调整的,但是如果为了使用原点为左下角的坐标系完全可以用坐标变

换实现,你只需要自己写一个自己的直线函数,即参数为以左下角为原点的直线的端点

的直线函数。并在函数中作一次坐标变换就可以了,举个例子:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
/*直线函数*/
void myline(int x1, int y1, int x2, int y2)
{
int ymax = getmaxy(); /*获得屏幕最低点的y坐标*/
y1 = ymax - y1; /*坐标变换*/
y2 = ymax - y2;
line(x1, y1, x2, y2);
}
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int xmax, ymax;

/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "h:\\work\\tc3\\bgi");

/* read result of initialization */
errorcode = graphresult();
/* an error occurred */
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}

setcolor(getmaxcolor());
xmax = getmaxx();
ymax = getmaxy();

/* 这是原来的直线函数*/
line(0, 0, xmax, ymax);
/* 这是变换后的直线函数*/
myline(0,0,xmax,ymax);
/* clean up */
getch();
closegraph();
return 0;
}

不过不推荐使用这种方法,其实,坐标原点在哪里都是一样的,用习惯就好了。

Ⅳ C语言实现经纬度的转换

办法很多,三维字符数组,指针字符数组都可以,分别保存字符串到数组元素,最后以%s输出即可。
我来写个最简单的

#include "stdafx.h"
#include "stdlib.h"
#include "string.h"

void explain_NS(char * str)
{
char tmp_ca[30] = "";
if(str[0] == 'N')
strcpy(tmp_ca,"北纬");
else
strcpy(tmp_ca,"南纬");
char *p = tmp_ca;
while(*p) p++;
strncpy(p, str+1, 2);
p += 2;
*p = 176;
p ++;
strncpy(p,str+3,2);
p += 2;
*p = 39;
p++;
strncpy(p, str+6,5);
p += 5;
*p = 34;
printf("%s\n",tmp_ca);
}
void explain_EW(char * str)
{
char tmp_ca[30] = "";
if(str[0] == 'E')
strcpy(tmp_ca,"东经");
else
strcpy(tmp_ca,"西经");
char *p = tmp_ca;
while(*p) p++;
strncpy(p, str+1, 3);
p += 3;
*p = 176;
p ++;
strncpy(p,str+4,2);
p += 2;
*p = 39;
p++;
strncpy(p, str+7,5);
p += 5;
*p = 34;
printf("%s\n",tmp_ca);
}
int _tmain(int argc, _TCHAR* argv[])
{
char ca[30] = "N3018.93661";
char cb[30] = "E12022.88281";
explain_NS(ca);
explain_EW(cb);
system("pause");
return 0;
}

Ⅵ C语言画图模式下如何将当前坐标赋给一个变量方面下面引用该坐标值。

楼主您好,你这个分值已经吸引了我
在下不才,也是自己写过一些c语言画图模式下的程序。所以我认为我在这一方面具有一定的权威.
(文本模式下)
我对于您的问题理解的不是很透彻,但是看字面意思来说,您是想当前坐标赋值给变量,我假设变量为(x、y)分别为x轴、y轴坐标变量。则将坐标赋值,为x=getx();y=gety();
(画图模式下)
在这里,我一般是直接对寄存器进行中断取得 鼠标 的值。在对他进行操作。
c语言只有以上2种模式,通过你的提问,我觉得你问的是文本模式下的。如果你觉得我回答不够详细,可以直接加QQ:942690451 询问。

Ⅶ 求一段C语言图形旋转就是整体坐标的转换的代码

原来的三点
line(25,50,50,50);
line(50,50,50,25);
line(50,25,25,50);
是个三角形
我想旋转一点的角度,该如何改写
如输入angle:30