1.?坐标坐标???Դ??
2.C语言编写程序输入任意两个量作为x,y的源码漫画站点源码坐标,计算该点到原点的代码unity 黄油 源码距离及与x轴的夹角。
?坐标坐标小说首页源码???Դ??
public class Cycle {
private double x = 0;//圆心横坐标
private double y = 0;//圆心纵坐标
private double r = 0;//圆心半径
public static void main(String[] args) {
String relation = "";
Cycle c = new Cycle(0,0,1);
//相交 外切 内切 相离
Cycle c_xiangJiao = new Cycle(3,4,5);
Cycle c_waiQie = new Cycle(3,4,4);
Cycle c_neiQie = new Cycle(3,4,6);
Cycle c_xiangLi = new Cycle(3,4,2);
relation = c.relationWithOtherCycle(c_xiangJiao);
System.out.println("c && c_xiangJiao relationShip :"+relation);
relation = c.relationWithOtherCycle(c_xiangLi);
System.out.println("c && c_xiangLi relationShip :"+relation);
relation = c.relationWithOtherCycle(c_neiQie);
System.out.println("c && c_neiQie relationShip :"+relation);
relation = c.relationWithOtherCycle(c_waiQie);
System.out.println("c && c_waiQie relationShip :"+relation);
}
public Cycle(double x, double y, double r) {
this.r = r;
this.x = x;
this.y = y;
}
public Cycle() {
}
public String relationWithOtherCycle(Cycle c){
String relation = ""; //相交 外切 内切 相离
double length = 0;// (x-x1)*(x-x1)+(y-y1)*(y-y1) 开平方
length = Math.sqrt((this.x-c.getX())*(this.x-c.getX())+(this.y-c.getY())*(this.y-c.getY()));
//System.out.println("length : "+length);
if(length>(this.r+c.getR())){
relation = "相离";
}else if (length==(this.r+c.getR())){
relation = "外切";
}else if (length==Math.abs(this.r-c.getR())){
relation = "内切";
}else if (length<Math.abs(this.r+c.getR())&&length>Math.abs(this.r-c.getR())){
relation = "相交";
}
return relation;
}
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
public double getR() {
return r;
}
public void setR(double r) {
this.r = r;
}
}
//把测试程序写在Cycle的main方法里了
C语言编写程序输入任意两个量作为x,y的源码编程源码解析坐标,计算该点到原点的代码fvq模型源码距离及与x轴的夹角。
#include <stdio.h>
#include <math.h>
#define PI 3.
int main ()
{
double x = 0,坐标坐标 y = 0;
double s = 0;
double angle;
printf("请输入x=");
scanf("%lf",&x);
printf("请输入y=");
scanf("%lf",&y);
printf("输入的点坐标为(%f,%f)\n",x,y);
s = sqrt(fabs(x)*fabs(x) + fabs(y)*fabs(y));
angle = atan2(y,x) * /PI;
printf("该点到原点的距离:%lf\n",s);
printf("该点到原点x轴的夹角:%lf°\n",angle);
}
源码如上
运行结果如下