Introduction

The goal of the 3D spherical kernel is to offer to the user a large set of functionalities on spheres, circles and circular arcs, in the 3D space or restricted on a given sphere. These functionalities require computing on algebraic numbers, which motivates the creation of a new kernel concept extending the CGAL Kernel concept, that is restricted to objects and functionality in a FieldNumberType.

All the choices (interface, robustness, representation, and so on) made here are consistent with the choices made in the CGAL kernel, for which we refer the user to the 2D and 3D Linear Kernel).

3D spherical kernel 的目标是给用户提供3D空间或严格地在给定球上的一套大量的面向球体、圆和圆弧的功能函数。这引起功能函数要求代数数的计算,激发了由概念CGAL Kernel扩展而创建一个新的内核,这个内核严格地使用基于FieldNumberType的对象和函数。

Spherical Kernel Objects

New main geometric objects are introduced by Spherical_kernel_3: circular arcs ((model of SphericalKernel::CircularArc_3), points of circular arcs (model of SphericalKernel::CircularArcPoint_3), and line segments (model of SphericalKernel::LineArc_3) whose endpoints are points of this new type.

SphericalKernel::CircularArcPoint_3 is used in particular for endpoints of arcs and intersection points between spheres, circles or arcs. The coordinates of these points are algebraic numbers of degree two. Therefore, general predicates offered by the Kernel on Point_3, which have coordinates in a FieldNumberType, would require heavy algebraic computations in algebraic extensions of higher degrees and thus are not provided on them, which explains the need for a new point type.

A consistent set of predicates and constructions is offered on these new types.

新的主几何对象由Spherical_kernel_3引入:圆弧((SphericalKernel::CircularArc_3概念的模型),圆弧上的点(SphericalKernel::CircularArcPoint_3概念的模型,和线段),线段(SphericalKernel::LineArc_3的模型)它的端点是是圆弧上的点)。

是特别用于圆弧的端点和球体、圆或弧的交集。这些点的坐标是2级代数数(algebraic numbers of degree two)。所以,本Kernel提供的面向 Point_3的通用判定(具有FieldNumberType类型坐标)在代数扩展到较高维度的情况下需要进行高强度的代数计算因而没有被提供,which explains the need for a new point type。

一个面向这一新类型的一致的判定和构造集合由本包提供。

General Functionalities

The spherical kernel currently implements a set of fundamental functionalities like intersection, comparisons, inclusion, etc. More might be provided in the future, as long as only algebraic numbers of degree two are used.

spherical kernel当前提供了一个基本函数集的实现:交集(intersection),比较(comparisons),包含(inclusion)等。更多的功能新在未来提供。

Functionalities Relative to a Sphere

The interface of the underlying objects is extended by providing additional operations that make sense only if the objects are considered on the same sphere. For example, the result of the comparison of the cylindrical or spherical coordinates of two points is well-defined only when looking at them on a given common sphere. The presentation of these operations requires the following definitions:

Coordinate system. Let consider a sphere with center c and radius r. Using the Cartesian frame centered at c, we define a cylindrical coordinate system (θ,z) on that sphere, with θ∈[0,2π) and z∈[−r,r]. θ is given in radian and measured in the xy-plane around the z-axis, starting from x>0, y=0. The z-extremal points of a sphere are its North and South poles defined as (θ,r) and (θ,−r) respectively, for any value of θ. Observe that each point on the sphere different from a pole corresponds to a unique pair (θ,z).

Definition of a meridian. Given a sphere and its associated cylindrical coordinate system, a meridian of that sphere is a circular arc consisting of the points having the same theta-coordinate (the poles are the end points). A plane containing the two poles of that sphere defines two meridians, one on each side of the line passing through the poles. A vector M whose direction is different from that of the latter line defines a unique meridian on that sphere. The plane of that meridian is defined by the direction of M and the two poles. The sense of M disambiguates the choice among the pair of meridians thus defined. On Figure 11.1, the normal vectors n0 and n1define two meridians of S: the circular arcs A0 and A1 respectively.

下层对象的接口提供了附加的操作,这些操作只有在对象是同一个球体时才有效。如,2个柱面或球面的点的坐标的比较结果是良好定义的,当且仅当将两个点放在一个给定的共同球上。这些操作的使用需要下面的定义:

坐标系统(Coordinate system。我们考虑一个球体,其圆心是c 半径是 r。使用笛卡尔坐标并将其中心定为 c,我们在球上定义柱面坐标系统(θ,z),其中 θ∈[0,2π) 且 z∈[−r,r]。θ由弧度给出且在xy面上上围绕z轴测定(由x>0, y=0起始)。 球的z极点分别是其北极 (θ,r)和南极点(θ,−r)。对于任意的角度 θ(即θ固定时). 观察球面上每个点的不同在于唯一的对(θ,z)确定的极。

子午线定义(Definition of a meridian.。给定一个球体和它相应的柱面坐标系统,球的一个子午线是一个包含了所有相同 θ 的点的一个圆弧(极点是其端点)。一个包含两极的平面定义了两个子午线,分别在两个极点连线的两侧。

一个向量M,其方向与前面定义的直线方向不同,它定义了唯一的球体子午线。子午线所在平面由M的方向和两个极点确定。M的定义消除了在选择两个子午线时的歧义。在图11.1中,正定(mormal) 的向量n0和n1定义了S的两个子午线:分别是圆弧A0和A1。

Figure 11.1 Definition of two meridians on S, a sphere of center c. The intersection of the plane P (passing through the two poles of S) and the sphere S is a circle. The two poles of S split that circle into two circular arcs A0 and A1, each being a meridian of S. The θ-coordinates of meridians A0 and A1 are θ0 and θ1=θ0+π respectively.

Types of circles on a sphere. Given a sphere, a circle on that sphere is termed polar if it goes through only one pole, bipolar if it goes through the two poles of that sphere and threaded if it separates the sphere into two connected components, each containing one pole. Any other circle is termed normal. These definitions are illustrated on Figure 11.2.

图11.1定义了S球体的两个子午线。通过S两个极点的平面P和S的交集是一个圆。A0和A1分别是S的两个子午线,它们由两个极点分开。这两个子午线的θ坐标分别是θ0 和 θ1=θ0+π。

球上的圆的类型(types of circles on a sphere)。如果一个圆只通过一个极点,则被称为极圆(polar );如果它通过两个极点,则为双极圆(bipolar )。如果它将球体分割为两个连接的部分,每个部分包含一个极点,则为间线圆(threaded );其他所有的圆被称为普通线(normal)。图11.2给出了几种线。

Figure 11.2 The four types of circles on a sphere. Black dots are the θ-extremal points.

θ-extremal points. Given a sphere one has: a θ-extremal point of a normal circle is a point of tangency between the circle and a meridian anchored at the poles of that sphere. Each normal circle defines two such points; the θ-extremal point of a polar circle is the pole the circle goes through. No such point is defined on a bipolar or a threaded circle. These definitions are illustrated on Figure 11.2. Notice that the θ-extremal points should not be confused with the endpoints of an arbitrary arc on a sphere.

The θ-coordinate of a θ-extremal point of a normal circle on a sphere is well defined. For a polar circle on a sphere, the plane containing the two poles and which is tangent to that circle contains two different meridians. The θ-values of these meridians are the two θ-coordinates associated to the same θ-extremal point of a polar circle.

θ-monotone circular arcs. An arc on a sphere is said to be θ-monotone if any meridian on that sphere intersects that arc in at most one point. With this definition, a circular arc on a threaded circle is always θ-monotone, and an arc on a polar or normal circle is θ-monotone if it does not contain a θ-extremal point, unless it is an endpoint. No such arc is defined on a bipolar circle.

θ-外部点(θ-extremal points.。给定一个球体,它有:一个普通圆的θ-外部点是该圆与一个子午线之间的切点。每个普通圆定义了两个这样的点;极圆(polar )的θ-外部点是该圆所经的极点。双极圆和间线圆(threaded )没有这个点定义。注意:不要将θ-外部点(θ-extremal points.)与球上的一个弧的端点相混淆。

一个普通圆(normal circle)θ-外部点(θ-extremal points.)的θ-坐标(θ-coordinate)是定义良好的。对一个球上极圆(polar ),与其相切、且过两极的的平面包含两个子午线。这两个子午线的θ-坐标值就是这个单θ-外部点的两个θ-坐标。

θ-单调圆弧(θ-monotone circular arcs. )如果一个球上的所有子午线与一个弧最多只有一个交点,则我们说这个弧是θ-单调圆弧。基于这一定义 ,我们发现所有 间线圆是θ-单调圆弧,而如果一个极圆(polar )或一个普通圆上的弧如果不含θ-外部点则它是θ-单调圆弧,除非它是一个端点。在双极圆上则没有θ-单调圆弧的概念定义。

Software Design

The design of Spherical_kernel_3 is similar to the design of Circular_kernel_2 (see Chapter 2D Circular Geometry Kernel).

It has two template parameters:

  • the first parameter must model the CGAL three dimensional Kernel concept. The spherical kernel derives from it, and it provides all elementary geometric objects like points, lines, spheres, circles and elementary functionality on them.
  • the second parameter is the algebraic kernel, which is responsible for computations on polynomials and algebraic numbers. It must model the concept AlgebraicKernelForSpheres. The robustness of the package relies on the fact that the algebraic kernel provides exact computations on algebraic objects.

The 3D spherical kernel uses the extensibility scheme presented in the kernel manual (see Section Extensible Kernel). The types of Kernel are inherited by the 3D spherical kernel and some types are taken from the AlgebraicKernelForSpheres parameter. Spherical_kernel_3 introduces new geometric objects as mentioned in Section Spherical Kernel Objects.

In fact, the spherical kernel is documented as a concept, SphericalKernel and two models are provided:

Spherical_kernel_3定义与的 Circular_kernel_2定义相似(see Chapter 2D Circular Geometry Kernel)。

它有两个模板参数:

  第一个参数必须是CGAL 3D  Kernel 概念的一个模型。spherical kernel 由它继承而来,它提供了所有基本的几何对象,如点,线,球体,圆和操作这些对象的基本的函数。

  第二个参数是代数内核(algebraic kernel),负责计算多项式和代数数。它必须是 AlgebraicKernelForSpheres概念的模型。本包的健壮性依赖于代数内核提供对代数对象的精确的计算。

3D spherical kernel 使用 kernel 手册中给出的可扩展模型((see Section Extensible Kerne)。3D spherical kernel继承了 Kernel 的类型,且有些类型取自于AlgebraicKernelForSpheres参数。Spherical_kernel_3 引入Spherical Kernel Objects一藬中提到的新的几何对象。

实际上,spherical kerne被载明是一个概念,其中提供SphericalKernel和两个模型:

  (1)Spherical_kernel_3<Kernel,AlgebraicKernelForSpheres>,即基本模型

  (2)一个预先定义的内核:Exact_spherical_kernel_3

Examples

The first example shows how to construct spheres and compute intersections on them using the global function.

第一个例子演示如何使用全局函数构造球体并计算它们的交集

File Circular_kernel_3/intersecting_spheres.cpp

#include <CGAL/Exact_spherical_kernel_3.h>
#include <CGAL/Random.h>
 
typedef CGAL::Exact_spherical_kernel_3 Spherical_k;
 
typedef CGAL::Sphere_3<Spherical_k> Sphere_3;
 
int main() {
 
CGAL::Random generatorOfgenerator;
int random_seed = generatorOfgenerator.get_int(0, 123456);
CGAL::Random theRandom(random_seed);
int count = 0;
 
std::cout << "We will compute the approximate probability that 3 spheres wit"
<< "h radius 1 intersect on a 5x5x5 box, it might take some time." << std::endl;
 
for(int i=0; i<10000; i++) {
 
double x1 = theRandom.get_double(0.0,5.0);
double y1 = theRandom.get_double(0.0,5.0);
double z1 = theRandom.get_double(0.0,5.0);
double r = 1.0;
double x2 = theRandom.get_double(0.0,5.0);
double y2 = theRandom.get_double(0.0,5.0);
double z2 = theRandom.get_double(0.0,5.0);
double x3 = theRandom.get_double(0.0,5.0);
double y3 = theRandom.get_double(0.0,5.0);
double z3 = theRandom.get_double(0.0,5.0);
 
Sphere_3 s1 = Sphere_3(Point_3(x1,y1,z1), r);
Sphere_3 s2 = Sphere_3(Point_3(x2,y2,z2), r);
Sphere_3 s3 = Sphere_3(Point_3(x3,y3,z3), r);
 
std::vector< CGAL::Object > intersecs;
CGAL::intersection(s1, s2, s3, std::back_inserter(intersecs));
if(intersecs.size() > 0) count++;
}
 
std::cout << "The approximate probability that 3 spheres with radius 1"
<< std::endl;
std::cout << "choosen (uniformly) randomly on a 5x5x5 box intersect is: "
<< ((double)count)/((double)(10000)) << std::endl;
 
return 0;
}
 
 

The second example illustrates the use of a functor.

第二个例子演示函子的使用。

File Circular_kernel_3/functor_has_on_3.cpp

#include <CGAL/Exact_spherical_kernel_3.h>
#include <CGAL/Random.h>
 
typedef CGAL::Exact_spherical_kernel_3 Spherical_k;
 
typedef CGAL::Circular_arc_3<Spherical_k> Circular_arc_3;
 
int main()
{
int n = 0;
Circular_arc_3 c = Circular_arc_3(Point_3(10,10,0), Point_3(5,5,5), Point_3(0, 0, 0));
for(int i = 0; i <= 10; i++) {
for(int j = 0; j <= 10; j++) {
for(int k = 0; k <= 10; k++) {
Point_3 p = Point_3(i, j, k);
if(Spherical_k().has_on_3_object()(c,p)) {
n++;
std::cout << "(" << i << "," << j << "," << k << ")" << std::endl;
}
}
}
}
 
std::cout << "There are " << n << " points in the "
<< "[0,..,10]x[0,..,10]x[0,...,10] "
<< "grid on the circular" << std::endl
<< " arc defined by the points (10,10,0), (5,5,5), (0,0,0)"
<< std::endl << "See the points above." << std::endl;
return 0;
}
 
 

The third example illustrates the use of a functor on objects on the same sphere. The intersection points of two circles on the same sphere are computed and their cylindrical coordinates are then compared.

第三个例子演示在同一个球体上的对象上使用函子。计算同一个球体上的两个弧的交点并比较它们的柱面坐标。

File Circular_kernel_3/functor_compare_theta_3.cpp

#include <CGAL/Exact_spherical_kernel_3.h>
 
 
int main(){
//construction of 3 spheres from their centers and squared radii
SK::Sphere_3 s1(SK::Point_3(0,0,0),2);
SK::Sphere_3 s2(SK::Point_3(0,1,0),1);
SK::Sphere_3 s3(SK::Point_3(1,0,0),3);
 
//construct two circles lying on sphere s1
SK::Circle_3 C1(s1,s2);
SK::Circle_3 C2(s1,s3);
 
SK::Intersect_3 inter;
//create a functor to compare theta-coordinates on sphere s1
SK::Compare_theta_z_3 cmp(s1);
std::vector< CGAL::Object > intersections;
inter(C1,C2,std::back_inserter(intersections));
 
//unsigned integer indicates multiplicity of intersection point
std::pair<SK::Circular_arc_point_3,unsigned> p1=
CGAL::object_cast< std::pair<SK::Circular_arc_point_3,unsigned> >(intersections[0]);
std::pair<SK::Circular_arc_point_3,unsigned> p2=
CGAL::object_cast< std::pair<SK::Circular_arc_point_3,unsigned> >(intersections[1]);
 
 
SK::Circular_arc_point_3 t_extreme[2];
//Compute theta extremal points of circle C1 on sphere s1
CGAL::theta_extremal_points(C1,s1,t_extreme);
 
//The theta coordinates of theta extremal points of C1 enclose that of each intersection point.
assert(cmp(t_extreme[0],p1.first)==CGAL::SMALLER);
assert(cmp(t_extreme[0],p2.first)==CGAL::SMALLER);
assert(cmp(t_extreme[1],p1.first)==CGAL::LARGER);
assert(cmp(t_extreme[1],p2.first)==CGAL::LARGER);
 
return 0;
}

Design and Implementation History

This package follows the design of the package 2D Circular Geometry Kernel).

Julien Hazebrouck and Damien Leroy participated in a first prototype.

The first version of the package was co-authored by Pedro Machado Manhães de Castro and Monique Teillaud, and integrated in CGAL 3.4. Frédéric Cazals and Sébastien Loriot extended the package by providing functionalities restricted on a given sphere [1].

Sylvain Pion is acknowledged for helpful discussions.

This work was partially supported by the IST Programme of the 6th Framework Programme of the EU as a STREP (FET Open Scheme) Project under Contract No IST-006413 (ACS - Algorithms for Complex Shapes).

3D Spherical Geometry Kernel( Geometry Kernels) CGAL 4.13 -User Manual的更多相关文章

  1. 2D and 3D Linear Geometry Kernel ( Geometry Kernels) CGAL 4.13 -User Manual

    1 Introduction CGAL, the Computational Geometry Algorithms Library, is written in C++ and consists o ...

  2. dD Geometry Kernel ( Geometry Kernels) CGAL 4.13 -User Manual

    1 Introduction This part of the reference manual covers the higher-dimensional kernel. The kernel co ...

  3. 2D Circular Geometry Kernel ( Geometry Kernels) CGAL 4.13 -User Manual

    1 Introduction The goal of the circular kernel is to offer to the user a large set of functionalitie ...

  4. 2D Polygons( Poygon) CGAL 4.13 -User Manual

    1 Introduction A polygon is a closed chain of edges. Several algorithms are available for polygons. ...

  5. 2D Convex Hulls and Extreme Points( Convex Hull Algorithms) CGAL 4.13 -User Manual

    1 Introduction A subset S⊆R2 is convex if for any two points p and q in the set the line segment wit ...

  6. Algebraic Foundations ( Arithmetic and Algebra) CGAL 4.13 -User Manual

    理解: 本节主要介绍CGAL的代数结构和概念之间的互操作.与传统数论不同,CGAL的代数结构关注于实数轴的“可嵌入”特征.它没有将所有传统数的集合映射到自己的代数结构概念中,避免使用“数的类型”这一术 ...

  7. Algebraic Kernel ( Arithmetic and Algebra) CGAL 4.13 -User Manual

    1 Introduction Real solving of polynomials is a fundamental problem with a wide application range. T ...

  8. Linear and Quadratic Programming Solver ( Arithmetic and Algebra) CGAL 4.13 -User Manual

    1 Which Programs can be Solved? This package lets you solve convex quadratic programs of the general ...

  9. Monotone and Sorted Matrix Search ( Arithmetic and Algebra) CGAL 4.13 -User Manual

    monotone_matrix_search() and sorted_matrix_search() are techniques that deal with the problem of eff ...

随机推荐

  1. 【校招面试 之 剑指offer】第9-1题 用两个栈实现一个队列

    #include<iostream> #include<stack> using namespace std; template <typename T> void ...

  2. JS 图片切换

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="zzzz.aspx.cs&quo ...

  3. runtime - 2 - 使用私有方法

    1. 创建 一个person类, 有对象方法, 私有化方法 2. 在h 文件里面 - (void)eat; //- (void)run:(NSInteger)metre; 3. 在m文件里面 -(vo ...

  4. socket编程介绍

    Python 提供了两个基本的 socket 模块. 第一个是 Socket,它提供了标准的 BSD Sockets API. 第二个是 SocketServer, 它提供了服务器中心类,可以简化网络 ...

  5. OpenSSL 结构体

    X509_STORE 头文件:x509_vfy.h 定义 typedef struct x509_store_st X509_STORE; struct x509_store_st { /* The ...

  6. 一款APP的交互文档从撰写到交付

    我第一份工作的设计总监是前百度设计师,34岁,一线设计12年:今年聊天说转了产品总监,如今39岁还活跃在行业中…… 我第二份工作的部门总监是前腾讯工程师,38岁,一线开发14年:2年前在Q群里跟我们说 ...

  7. 用户体验要好,App动画得这么做

    以下内容由Mockplus团队翻译整理,仅供学习交流,Mockplus是更快更简单的原型设计工具.   在用户体验设计方面,App动画的设计和添加,带给设计师无限的创造空间的同时,也成为设计师群体最具 ...

  8. 专2-第二课 Eclipse开发环境搭建

    2.1下载Eclipse 2.2 安装C/C++版本的Eclipse 2.3 安装JDT插件开发Java程序 2.4 使用Eclipse开发驱动程序 既然安装了eclipse来进行驱动学习,那么我们就 ...

  9. Python鸭子类型思想

    动态语言中经常提到鸭子类型,所谓鸭子类型就是:如果走起路来像鸭子,叫起来也像鸭子,那么它就是鸭子(If it walks like a duck and quacks like a duck, it ...

  10. 技术管理zz

    1.管理者最重要的是规划Roadmap 技术管理者并不能完全脱离技术.最少要把握最新技术的发展,了解团队当前技术现状和不足.用于规划的时间应该不少于50%的工作时间.具体而言,规划又分为业务规划和团队 ...