- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
ACM常用模板--三维几何(Common template of ACM - three-dimensional geometry)
ACM常用模板--三维几何(Common template of ACM - three-dimensional geometry)
/ / three-dimensional geometry function library
H # include math.h
# define eps 1 e - 8 -
# define zero (x) (((x) 0, (x) : - (x)) (eps)
Struct point3 {double x, y, z; };
Struct line3 {point3 a, b; };
Struct plane3 {point3 a, b, c; };
/ / calculate cross product U x V
Point3 xmult (point3 point3 u, v) {
Point3 ret.
Ret. X = v.z - v.y u.y * * u.z;
Ret. Y = v.x - u.x u.z * * v.z;
Ret. Z = v.y - u.y u.x * * v.x;
Return ret.
}
/ / compute dot product U. V
Double dmult (point3 point3 u, v) {
Return u.x + v.y + u.z u.y * * * v.x v.z;
}
/ / vector difference U minus V
Point3 subt (point3 point3 u, v) {
Point3 ret.
Ret. X = u.x - v.x;
Ret. Y = u.y - v.y;
Ret. Z = u.z - v.z;
Return ret.
}
/ / take the plane normal vector
Point3 pvec (plane3 s) {
Return xmult (subt (s.a, s.b), subt (s.b, s.c));
}
Point3 pvec (point3 s1, point3 s2, point3 s3) {
Return xmult (subt (s1, s2), subt (s2, s3));
}
/ / two points distance, single parameter orientation volume
Double short (point3 point3 p1, p2) {
Return SQRT ((p1) X-ray p2) x) * (p1) X-ray p2) x) + (p1) y - p2) y) * (p1) y - p2) y) + (p1. Z - p2. Z) * z (p1) z - p2)));
}
/ / vector size
Double vlen (point3 p) {
Return SQRT (p.x * p.x + p.y + p.z p.y * * p.z);
}
/ / the three-point common line
Int dots_inline (point3 p1, point3 p2, point3 p3) {
Return vlen (xmult (subt (p1, p2), subt (p2, p3))) eps;
}
/ / there is a total of four
Int dots_onplane (point3 a, point3 b, point3 c, point3 d) {
Return zero (dmult (pvec (a, b, c), subt (d, a)));
}
/ / whether the points are in the line segment, including the endpoints and collinear
Int dot_online_in (point3 p, line3 l) {
Return zero (vlen (xmult (subt (p, L.A.), subt (p, l.b)))) (L.A.X - p.x) * (L.B.X - p.x) eps
(L.A.Y - p.y) * (L.B.Y - p.y) eps (L.A.Z - p.z) * (L.B.Z - p.z) eps;
}
Int dot_online_in (point3 p, point3 l1, point3 l2) {
Return zero (vlen (xmult (subt (p, l1), subt (p, l2)))) (l1. X-ray p.x) * (l2) x - p.
您可能关注的文档
- 高中数学(High school math).doc
- 高中新课程作业本_物理_选修3-4_选修3-5(New curriculum in high school. Physics _ elective 3-4_ elective 3-5).doc
- 高中新课程作业本_化学_选修4-化学反应原理答案(New curriculum in high school chemistry _ elective 4 - chemical reaction theory answer).doc
- 高中新课程作业本数学 必修四(The new curriculum in high school is compulsory in mathematics).doc
- 高中物理必背知识点实用口诀(TXT手机版)(Practical tips for high school physics (TXT)).doc
- 高中物理解题方法(High school physics problem method).doc
- 高中课本中出现的生物史(The history of biology in high school textbooks).doc
- 高中生物实验汇总(High school biology experiment summary).doc
- 高二下学期化学复习计划03月23日(The chemistry review program for the second term is March 23).doc
- 高二 (上)文化生活 考试试题(High school cultural life exam).doc
- ACAA认证平面设计师模拟题2(ACAA certification graphic designer emulation 2).doc
- Download对讲机工作原理(确定)(How to work with the Download intercom (determination)).doc
- ACM必做50题的解题-计算几何(The ACM is going to do 50 problem solving -- calculate the geometry).doc
- DRAC使用讲义(DRAC USES handouts).doc
- DTL和TTL(DTL and TTL).doc
- DropDownList详解(DropDownList,).doc
- dsafa 文本文档(Dsafa text document).doc
- DSP常用函数(DSP common functions).doc
- EDID知识简介(Knowledge profile of EDID).doc
- DUPONT 产 品(DUPONT products).doc
最近下载
- 标准图集-22J603-1 铝合金门窗.pdf VIP
- 2025—2026玉屏中心小学第一学期工作计划(初稿).doc VIP
- 食堂应急预案.pdf VIP
- SY_T 5163-2018沉积岩中黏土矿物和常见非黏土矿物X射线衍射分析方法.pdf
- 职高优秀教学反思.pdf VIP
- 三年(2023-2025)高考语文真题分类汇编:专题01 信息类文本阅读(连续性文本阅读)(全国通用)(原卷版).docx VIP
- C++程序开发教程-PPT课件(全).pptx
- 《有机化学》徐寿昌 第二版 第14章 β-二羰基化合物.ppt VIP
- 安全阀基础知识培训课件.pptx VIP
- 人工造林施工组织设计技术方案.doc VIP
文档评论(0)