Geometry
uva1473 这题说的是 在空间中给了n个点 然后用体积最小的圆锥将这些点包含在内可以在表面上, 将这些点 映射到xoz平面上然后,然后枚举每个上凸包的边和每个点的极值进行判断求得最小的体积 我们会发现最小的体积 要不就紧贴一个点要不然就会贴住两个点
#include <iostream>
#include <cstdio>
#include <string.h>
#include <cmath>
#include <algorithm>
using namespace std;
const double INF =1.79769e+308;
const double eps = 0.000000000001;
int dcmp(double a)
{
if(fabs(a)<=eps) return ;
return a>?:-;
}
struct point {
double x,y;
point(double a=, double b=){
x=a; y=b;
}
point operator -(point A){
return point(x-A.x, y-A.y);
}
bool operator <(point A)const{
return dcmp(x-A.x)<||(dcmp(x-A.x)==&&dcmp(y-A.y)<=);
}
}P[],ch[];
int n;
double Cross(point A, point B)
{
return A.x*B.y-A.y*B.x;
}
int Conxtull(int &G)
{
sort(P,P+n);
int m=;
for(int i =; i<n ; ++i )
{
while(m>&&dcmp( Cross( ( ch[m-] - ch[m-] ), ( P[i] - ch[m-] ) ) )<=)m--;
ch[ m++ ] = P[i];
}
int k = m;
for(int i = n-; i>=; --i )
{
while( k<m&&dcmp( Cross( ch[m-]-ch[m-], P[i]-ch[m-] ) )<= ) m--;
ch[m++] = P[i] ;
}
if(n>)m--;
G=m;
return k-;
}
point getpoint(double k,point F)
{
point ans;
ans.x = F.x+(F.y/k);
ans.y = F.y+k*F.x;
return ans;
}
double Volun(double radio, double hight)
{
return acos(-)*radio*radio*hight/3.0;
}
double Volume,ansR,ansH;
void solve(double k,point T)
{
point e = getpoint(k,T);
double V =Volun(e.x,e.y);
if(dcmp(Volume-V)>){
ansR=e.x; ansH=e.y;
Volume=V;
}
}
int main()
{
freopen("data.in","r",stdin);
freopen("data.out","w",stdout);
while(scanf("%d",&n)==)
{
n++;
double Minx=0.0;
P[]=point(,);
for(int i = ; i<n; ++i)
{
double x,y,z;
scanf("%lf%lf%lf",&x,&y,&z);
P[i].x=sqrt(x*x+y*y);
P[i].y=z;
Minx = max(Minx,P[i].x);
}
int m;
int k =Conxtull(m);
ch[m]=ch[];
Volume=INF;
double K=INF;
int we;
for(int i=k; i<m; ++i )
{
if(i==m-||dcmp(ch[i].x-ch[i+].x)<=||dcmp(ch[i].y-ch[i+].y)>=)
{
we=i;
break;
}
double R =(ch[i+].y-ch[i].y)/(ch[i].x-ch[i+].x);
double t =ch[i].y*;
t/=ch[i].x;
int f1 =dcmp(t-R);
int f2=dcmp(t-K);
if(f1>=&&f2<=)
solve(t,ch[i]);
solve(R,ch[i]);
K=R;
}
double t = 2.0*ch[we].y/ch[we].x;
if(dcmp(t-K)<)
solve(t,ch[we]);
printf("%.3lf %.3lf\n",ansH,ansR);
} return ;
}
uva 12165 这题说的是 用梅涅劳斯 计算图中三角形的对应的比例列出一堆后 开始拆分那些边然后化简就会达到所要的公式
#include <iostream>
#include <string.h>
#include <cmath>
#include <cstdio>
using namespace std;
struct point{
double x,y;
point(double a=,double b=){
x=a; y =b;
}
point operator +(point A){
return point(x+A.x,y+A.y);
}
point operator -(point A){
return point(x-A.x,y-A.y);
}
point operator *(double A){
return point(x*A,y*A);
}
};
double Cross(point A,point B){
return A.x*B.y-A.y*B.x;
}
double Dot(point A,point B){
return A.x*B.x+A.y*B.y;
}
double Length(point A){
return sqrt(Dot(A,A));
}
int main()
{ double m1,m2,m3,m4,m5,m6;
point P,Q,R;
int cas;
scanf("%d",&cas);
for(int cc=; cc<=cas; ++cc){ scanf("%lf%lf%lf%lf%lf%lf",&P.x,&P.y,&Q.x,&Q.y,&R.x,&R.y);
scanf("%lf%lf%lf%lf%lf%lf",&m1,&m2,&m3,&m4,&m5,&m6);
double c =Length(P-Q),a =Length(R-Q), b =Length(P-R);
double m = m3*m5/(m6*(m3+m4));
double n = m4*m2/((m3+m4)*m1);
double BP = (c+m*c)/(n-m);
m = (m5*m1)/((m5+m6)*m2);
n = m6*m4/((m5+m6)*m3);
double CQ = (m*a+a)/(n-m);
m = m1*m3/((m1+m2)*m4);
n =m2*m6/((m1+m2)*m5);
double AR = (m*b+b)/(n-m);
point PR = (R-P)*(/Length(R-P));
point A = R +(PR*AR);
point QP = (P-Q)*(/Length(P-Q));
point B = P+(QP*BP);
point RQ = (Q-R)*(/Length(Q-R));
point C = Q+(RQ*CQ);
printf("%.8lf %.8lf %.8lf %.8lf %.8lf %.8lf\n",A.x,A.y,B.x,B.y,C.x,C.y);
} return ;
}
的
Geometry的更多相关文章
- CSharpGL(14)用geometry shader渲染模型的法线(normal)
+BIT祝威+悄悄在此留下版了个权的信息说: CSharpGL(14)用geometry shader渲染模型的法线(normal) +BIT祝威+悄悄在此留下版了个权的信息说: 2016-08-13 ...
- the operation was attempted on an empty geometry Arcgis Project异常
处理gis数据,投影变换时出现异常: the operation was attempted on an empty geometry 解决思路: arcgis的repair geometry方法:删 ...
- Topology and Geometry in OpenCascade-Adapters
Topology and Geometry in OpenCascade-Adapters eryar@163.com 摘要Abstract:本文简要介绍了适配器模式(adapter pattern) ...
- HDU1086You can Solve a Geometry Problem too(判断线段相交)
You can Solve a Geometry Problem too Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/3 ...
- <<Differential Geometry of Curves and Surfaces>>笔记
<Differential Geometry of Curves and Surfaces> by Manfredo P. do Carmo real line Rinterval I== ...
- Geometry shader总结
什么是Geometry Shader GS存在于vertext shader和固定功能vertex post-processing stage之间,它是可选的不是必要的.GS的输入是单个primiti ...
- Geometry Stage in Rendering pipeline (读书笔记2 --- Real-Time rendering)
Geometry Stage一般包含下面几个阶段 1. Model & View Transform(模型和视图变换) --- 模型空间--> 世界空间 模型变换:每个模型经过模型变换来 ...
- WPF的二维绘图(二)——几何图形Geometry
在WPF的DrawingContext对象中,提供了基本的绘制椭圆和矩形的API:DrawEllipse和DrawRectangle.但是,这些是远远不够用的,我们在日常应用中,更多的是使用DrawG ...
- Geometry关系高级操作
一些高级的操作 几何形状Geometry缓冲(buffer) 线段的融合(linemerge)是将Geometry A中相互连接的线段进行连接 多边形化操作(polygonize)对Geometry ...
- java程序操作Geometry对象
Geometry 空间地理对象,Oracle中存储Geometry对象的字段类型是 MDSYS.SDO_GEOMETRY,在数据库中构建Geometry对象的方法: v_pointarray MDSY ...
随机推荐
- Unity3D笔记十四 力
Unity中力的方式有两种:第一种为普通力,需要设定力的方向与大小:第二种为目标位置力,需要设定目标点的位置,该物体将朝向这个目标位置施加力. 1.案例 添加两个球体和一个立方体,另外还要给两个球体添 ...
- linux启动程序和关闭程序脚本
关闭脚本: #!/bin/bash source /etc/profile log() { echo `date +[%Y-%m-%d" "%H:%M:%S]` $1 } log ...
- 三个Linux权限
Linux有三种不同类型的用户可对文件或目录进行访问,分别是:文件所有者,同组用户.其他用户. 每一文件或目录的访问权限都有三组,每组用三位表示,分别为:1)文件属主的读.写和执行权限:2)和属主同组 ...
- Scala学习笔记(1)-基本类型归纳
1.小试牛刀 使用Scala自带的REPL shell(Read Evaluate Print Loop)学习和尝试Scala语言库,创建的变量在会话期间都是有效的. Ctrl+D可退出REPL sh ...
- CSU 1809 - Parenthesis - [前缀和+维护区间最小值][线段树/RMQ]
题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1809 Bobo has a balanced parenthesis sequenc ...
- codeforces 761D - Dasha and Very Difficult Problem
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- ORACLE 根据根节点查所有上层节点
1.基本数据 SELECT * FROM TABLE_MUEN T ID CODE NAME ...
- WIN7怎么把暴风影视库去除?
最近在win7 64位系统上安装新版暴风,打开我的电脑里面多了个暴风影视库图标,点击右键也没有删除 每次一打开“计算机”看见这个很碍眼.怎么把它关闭呢? 方法如下: 打开注册表,删除此项 HKEY_C ...
- Code--POJ1850
Description Transmitting and memorizing information is a task that requires different coding systems ...
- 优云软件助阵GOPS·2017全球运维大会北京站
GOPS· 2017全球运维大会北京站于2017年7月28日-29日在北京隆重举办,汇聚国内一线运维专家和诸多运维同仁达800余名.作为长期致力于企业级高端运维市场软件开发和咨询服务的优云软件受邀参与 ...