当前位置:文档之家› Integral Invariants for Robust Geometry_期刊版

Integral Invariants for Robust Geometry_期刊版

Integral Invariants for Robust Geometry_期刊版
Integral Invariants for Robust Geometry_期刊版

Integral Invariants for Robust Geometry Processing

Helmut Pottmann

TU Wien

Johannes Wallner

TU Graz

Qi-Xing Huang Stanford University

Yong-Liang Yang Tsinghua University

Abstract

Differential invariants of curves and surfaces such as curvatures and their derivatives play a central role in Geometry Processing.They are,however,sensitive to noise and minor perturbations and do not exhibit the desired multi-scale behaviour.Recently,the relation-ships between differential invariants and certain integrals over small neighborhoods have been used to de?ne ef?ciently computable in-tegral invariants which have both a geometric meaning and useful stability properties.This paper considers integral invariants de?ned via distance functions,and the stability analysis of integral invari-ants in general.Such invariants proved useful for many tasks where the computation of shape characteristics is important.A prominent and recent example is the automatic reassembling of broken objects based on correspondences between fracture surfaces.

Keywords:geometry processing,curvature,integral invariant,sta-bility,3D shape understanding

1Introduction

Local shape analysis of curves and surfaces usually employs con-cepts of elementary differential geometry like curvatures (see e.g.[do Carmo 1976;Porteous 2001]).Likewise,global shape under-standing bene?ts from differential geometry concepts like principal curvature lines or crest lines (see for instance [Alliez et al.2003;Hildebrandt et al.2005;Kim and Kim 2005;Ohtake et al.2004;Yokoya and Levine 1989]).However,the actual computation of curvatures for real data,given as triangle meshes or voxel grids,is a nontrivial task,because numerical differentiation is sensitive to noise.A standard method to deal with rough data is denoising and smoothing prior to numeric computation.These techniques come in two categories:Global methods which employ appropriate geo-metric ?ows (cf.[Bajaj and Xu 2003;Clarenz et al.2004b;Osher and Fedkiw 2002])and local ones,which use approximation by smooth surfaces (cf.[Taubin 1995;Cazals and Pouget 2003;Gold-feather and Interrante 2004;Ohtake et al.2004;Razdan and Bae 2005]).We especially want to mention the method of tensor voting (cf.[Tong and Tang 2005]).Semi-differential invariants in the sense of [Van Gool et al.1992]are a way of avoiding higher derivatives by combining reference points with ?rst order derivatives.An alternative approach to differential geometry for

employ an exact theory of discrete analogues of ties,instead of numerically approximating the area of research,which could be called discrete etry in a narrower sense,has been investigated for a many results have been achieved –see e.g.work by and Zalgaller 1967],[Cheeger et al.1984],[Pinkall 1993],[Bobenko and Pinkall 1996],[Polthier 2002],2002],[Cohen-Steiner and Morvan 2003],[Bobenko 2005].It is possible to deal with noisy data using theories,as shown by [Hildebrandt and Polthier Klette 2006],and [Rusinkiewicz 2004].However,data appears to be neither the main strength nor the of an entirely discrete theory.

Typically a discrete theory of curvatures associates them to vertices or edges or faces in a mesh,and such a discrete curvature often to appear in Computer Aided Geometric Design

has an interpretation,e.g.as ‘curvature concentrated in a vertex’,or ‘integral of curvature over a face’.This measure-theoretic in-terpretation of curvatures should not be confused with the integral invariants of the present paper.

Our approach to the numerical problems inherent in the computa-tion of higher order differential invariants of noisy geometry is the following:For given 3D data,we integrate various functions over suitable small kernel domains like balls and spheres,which yields integral invariants associated with each kernel location.These in-variants turn out to have a geometric meaning and can be used as curvature estimators.This method has been initiated by [Manay et al.2004]and [Connolly 1986]and is also the topic of [Yang et al.2006;Pottmann et al.2007].

The following properties of curvature estimators are important:?Robustness with respect to noise,including discretization ar-tifacts;?Multi-scale behaviour,i.e.,adaptability to the choice of reso-lution.Integration,which is an essential ingredient in the de?nition of in-tegral invariants,has a smoothing effect and achieves stability and robustness without the need for preprocessing.

The present paper studies robustness aspects of integral invariants,as well as integral invariants related to distance functions.Thus we establish the theoretical explanation of robustness properties en-countered in numerical experiments and geometry processing algo-rithms.For the volume descriptor and similar invariants the rela-tion to shape (i.e.,curvatures)have already been established;we here present this analysis for geometry descriptors based on dis-tance functions.

1A Prior Work

The ?rst to introduce integral invariants were [Manay et al.2004].One example is the area invariant suitable for estimating the curva-ture of a curve c at a point p ,where c is assumed to be the boundary of a planar domain D (see Fig.1,left):Consider the circular disk B r (p )of radius r and center p ,and compute the area A r (p )of the centered in a point p .The area invariant (left)is the surface area of the intersection of the disk p +rB with the domain D ,whereas the Connolly function (right)is the perimeter of the arc (p +rS )∩D divided by r .

ture yields a way to estimate curvature at scale r,because features smaller than r hardly in?uence the result of computation.Manay et al.show the superior performance of this and other integral in-variants on noisy data,especially for the reliable retrieval of shapes from geometric databases.

A similar invariant appears in earlier work(see Fig.1,right):The angle of the circular arc?

B r(p)∩D has been used by[Connolly 1986]for molecular shape analysis.If we multiply this so-called Connolly function by the kernel radius r,we obtain the length of the circular arc,which happens to be the derivative of the area invariant with respect to the kernel radius.

The extensions of area invariant and Connolly function to surfaces in three-space are straightforward.One arrives at the volume de-scriptor,whose relation to mean curvature is derived by[Hulin and Troyanov2003],and which is used by[Gelfand et al.2005]for global surface matching.Its derivative with respect to r is the sur-face area of the spherical patch?B r(p)∩D(see[Connolly1986]). The precise relation between these integral invariants on the one hand,and the curvature of planar curves and the mean curvature on surfaces on the other hand,has been derived by[Cazals et al.2003]. Principal component analysis of the domain B r(p)∩D is done by integrating coordinate functions and their products over that do-main.Therefore also principal moments of inertia and principal directions of B r(p)∩D are integral invariants.A discussion of their relation to principal curvatures and of computational issues is given by[Pottmann et al.2007],while[Yang et al.2006]shows applications and compares this method with other ways of estimat-ing principal curvatures.We also point to[Clarenz et al.2004b; Clarenz et al.2004a],who use principal component analysis of sur-face patches for feature detection.

Results of a similar?avour,without the emphasis on computability and robustness,are the formulae of J.Bertrand and V.A.Puiseux (1848)which relate Gaussian curvature to perimeter and area of geodesic disks(cf.p.127of[Strubecker1969]).

1B Organization and main contributions of the present paper

Our paper is organized as follows:After introducing notation and some basic facts in sections2and3,we brie?y discuss integral in-variants for planar curves in Section4.Those are mainly the area invariant and its derivatives with respect to kernel radius and kernel center,respectively.The analogous but slightly more involved dis-cussion of the3D counterparts,namely the volume descriptor and its derivatives,is performed in Section5.Section6studies invari-ants for curves in surfaces and shows how to obtain the geodesic curvature by integration.Invariants based on distance functions are the topic of Section7–both for surfaces and for space curves. Section8analyzes the stability of some important integral invari-ants in the presence of noise or surface perturbations.Section9 is concerned with ef?cient computation and implementation issues. Applications are brie?y surveyed in Section10.We conclude our paper with Section11,which contains pointers to future research. The main contributions of the present paper are(i)new facts about asymptotics expansion of integral invariants and their relations to curvature,notably those computed from distance functions(ii)a thorough theoretical stability and robustness analysis of integral in-variants,with a focus on the volume descriptor;(iii)methods for computing integral invariants,especially the octree-based approach of Section9B.2Basics

2A Notation and de?nition of integral invariants

In this paper we assume that a curve in R2or a surface in R3is the

boundary?D of a domain D in R n,with n=2,3,respectively

(locally,this is always the case,so this is no actual restriction).We

write1D for the indicator function of that domain:1D(x)=1if

the point x is contained in D,and1D(x)=0otherwise.

B denotes the unit ball,and p+rB denotes the ball with radius r and center p.In R2,such a ball is actually a disk,but we use the

same notation regardless of dimension.Further,the unit circle of

R2and the unit sphere of R3are denoted by S.S is the boundary of B.The symbol p+rS denotes the sphere or circle with center

p and radius r.

In many cases,integral invariants,evaluated at the boundary point

p of a domain D,have the form of one of the two following convo-lution integrals:

I r(p)=

Z

p+rB

g(x)w(p?x)d x,I r(p)=

Z

p+rS

g(x)w(p?x)d x,(1)

where g is a function associated with the domain(e.g.,its indica-tor function or the distance from the boundary),and w is a weight function(e.g.,a constant).The symbol d x has various meanings, depending on the domain of integration.E.g.in dimension n=3, when integrating over the domain p+rB,it means a volume inte-gral.In dimension n=2,when integrating over p+rS,it means an arc length integral.In the remaining cases(n=3,integral over a sphere,and n=2,integral over a disk)d x means an area integral. As an example,both the area invariant and the Connolly function (cf.Fig.1)have the general form of Equation(1):we let g(x)= 1D(x)and w(x)=1.

2B Integral invariants as functions of the kernel radius

For geometry processing applications,the multi-scale behaviour of an integral invariant de?ned by(1)is important,which means the change of its value,if the kernel radius r varies.This leads us to consider integral invariants as univariate functions of the kernel ra-dius.A useful piece of information on these functions is the general relation

d

dr

I r(p)=I r(p),(2) which follows immediately from the product formula for integrals: I r(p)=

R r

I ρ(p)dρ(see[Pottmann et al.2007]).Another im-portant topic is the asymptotic behaviour when the kernel radius r tends to zero.[Pottmann et al.2007]give a general recipe for computing the?rst few terms in the Taylor expansion of I r(p).In-variants which are of this type are the area and volume functionals (see below),geometry descriptors based on the distance function (introduced in the present paper),and quantities used in principal component analysis(cf.[Yang et al.2006;Pottmann et al.2007]).

2C Integral invariants as functions of the kernel center

When the radius used in the de?nition of an integral invariant I r(p) or I r(p)is kept constant,then this invariant is a function of the point https://www.doczj.com/doc/6b15082894.html,ually we are interested in the values of the invariant when the point p is situated on the surface under investigation.The relations between integral invariants and geometric characteristics of the surface(mostly curvatures),which one is interested in,are no longer valid if p is not contained in the surface.

Nevertheless we are interested in the behaviour of the invariant when p leaves the surface.The main reason for this is that in ac-tual computations we are often concerned with imprecise or quan-tized data,and the point for which integral invariants are eval-uated may actually lie at some distance from the hypothetical smooth surface under consideration.In order to estimate the ef-fect of these perturbations,we compute the gradient vector ?I r =(??p 1,??p 2,?

?p 3)·R p +rB g (x )d x ,and the same for I r (p ).The magnitude of perturbation is then measured by I r (p +?p )=I r (p )+ ?p ,?I r (p ) +O (2),where O (2)denotes second or-der terms and , is the scalar product of vectors.Consequently,we can give a simple estimate for the change ?I r in the integral invariant in terms of the change in the point p :Approximately, ?I r ?p · ?I r .

3Facts about curves and surfaces

This material is found e.g.in the monographs by [do Carmo 1976]or [Spivak 1975].References for the facts on distance functions quoted below are [Ambrosio and Mantegazza 1998]and [Pottmann and Hofer 2003].

3A Planar curves

For every point p of a suf?ciently smooth curve c we can choose a Cartesian coordinate system with p as origin,such that the x 1axis is tangent to the curve (the Frenet frame).With respect to such coordinates,the curve may be written as the graph of a function

x 2=f (x 1),with f (x 1)=αx 21+βx 31+γx 41+O (x 5

1).With the well known formula κ=f (1+(f )2)?3/2for the curva-ture we can relate the coef?cients in the Taylor expansion with the derivatives of the curvatures;the result is

x 2=κ2x 21+κ 6x 31+κ ?3κ324

x 4

1+O (x 51).

(3)

Here the derivatives κ and κ of the curvature are with respect

to x 1.For x 1=0this is also the derivative with respect to arc length.If the curve is of lesser smoothness,this Taylor expansion terminates not with O (x 51),but earlier.Because we need it later,we record in this place the coordinate of the intersection points c +r and

c ?r of this curve with the circle x 21+x 22=r 2(see Fig.2):c +

r =

(r,κ2r 2

)+(?κ28,κ 6)r 3+(?κκ 12,κ 24)r 4+O (r 5).The coordinates of c ?r are found by substituting ?r for r in the previous formula.

3B Surfaces

Next,we discuss coordinate systems for surfaces.For every point p of a suf?ciently smooth surface Φthere is a coordinate system with p as origin,such that the surface can be written as the graph of a function

x 3=

1(κ1x 21+κ2x 22)+R (x 1,x 2),(4)

where κ1,κ2are the principal curvatures of the surface in the point p ,and the remainder term R (x 1,x 2)is bounded by |R (x 1,x 2)|≤C ·(p x 21+x 22)3,i.e.,it is of third order.Mean curvature H and

Gaussian curvature K are de?ned by H =κ1+κ2

,K =κ1κ2.If the surface is the boundary of the domain D ,we assume that the positive x 3axis points to the inside of D ,so that a convex domain gets nonnegative curvatures.The distance of a point x ∈R 3from the surface can be given a sign,depending on whether x is inside D or outside:dist(x ,Φ)>0??x ∈D.Recall that the distance,signed or not,ful?lls the eikonal equation ?dist(x ,Φ) =1.A

Taylor approximation of the signed distance function is given by dist(x ,Φ)=

1(κ1x 21+κ2x 22)?x 3+O (3),(5)where O (3)means a third order remainder term (we use f (x )=O (k )as an abbreviation of f (x )=O ( x k )as x →0).Note that this Taylor expansion does not contain any quadratic terms which involve x 3(cf.[Ambrosio and Mantegazza 1998;Pottmann and Hofer 2003]).

3C Space curves

A space curve c (u )has several orthonormal frames associated with it.For the purposes of this paragraph,we assume that u is an arc length parameter,and a dot indicates differentiation with respect to

u .Then the Frenet frame {t ,h ,b }is de?ned by t =˙c

,˙t =κh ,and b =t ×h .Here κis the curvature.Further,˙b

=?τh ,where τis the torsion of the curve.By rotation of the Frenet frame about the unit tangent vector t we get the class of frames {t ,e 1,e 2}with e 1=cos φh +sin φb and e 2=?sin φh +cos φb .If we

choose the function φsuch that ˙φ

=?τ,then both ˙e 1and ˙e 2are proportional to t ,and {t ,e 1,e 2}is called a rotation-minimizing frame.

Now consider the ruled surface Ψ1parametrized by g 1(u,v )=c (u )+v e 1(u ).By differentiation we see that the partial deriva-tives g 1,u ,g 1,v and therefore the tangent plane of Ψ1in the point g 1(u,v )is spanned by t (u )and e 1(u ).As there is no dependence on v ,the surface is developable.An analogous result is true for the surface Ψ2which is de?ned via e 2.It follows that the planes orthogonal to c are orthogonal to both Ψ1and Ψ2,and therefore

dist(x ,c )2=dist(x ,Ψ1)2+dist(x ,Ψ2)2.

(6)

As the surface Ψ1is developable,its principal frame in the point

c (u )=g 1(u,0)is {t ,e 1,e 2},with e 2as normal vector.By Meusnier’s theorem,the principal curvatures have the values κ1=κcos (h ,e 2)=κcos(φ+π/2)an

d κ2=0.For th

e surface Ψ2,the principal frame is {?t ,e 2,e 1},and the principal curva-tures have the values κ1=κcos (h ,e 1)=κcos φand κ2=0.This information will be useful when computing distance functions.

3D Curves in surfaces

A curve c contained in a surface Φhas an associated Darboux frame {t ,e 2,n },where t is the unit tangent vector of c ,n is the sur-face normal vector,and e 2=n ×t .If the curve is traversed

with unit speed,then ˙t

=κg e 2+κn n ,˙e 2=?κg t +τg n ,and ˙n

=?κn t ?τg e 2.The coef?cient functions κg ,κn ,τg which occur here are the geodesic curvature,normal curvature,and geodesic torsion of the curve c w.r.t.Φ,respectively.In this place we would like to mention the famous Gauss-Bonnet formula:For a closed curve c with interior D ?Φ,we have the identity H c κg =2π?R D K (x )d x ,with K as the Gaussian curvature of the surface Φ.

4

Simple invariants for planar curves

4A

Area invariant and Connolly function

Given a planar curve c which occurs as the boundary of the planar domain D ,and a point p ∈c ,[Manay et al.2004]de?ne the area invariant as the invariant I r according to Equation (1)with g =1D and w (x )=1=const .,i.e.,

A r (p ):=Z

p +rB

1D (x )d x .(7)

p

p c

(a)

(b) p

(c)(d)

Figure2:Deriving the gradient of the area invariant.(a)The point p is moved towards p+d.(b)This is equivalent to moving the curve

c in the opposite direction.(c)The area difference is highlighted.

(d)The apparent length L d of the chord c+r?c?r when viewed in direction d contributes to the area difference.

A r is the area of the intersection D∩

B r(p)of the curve’s interior and the kernel disk B r(p).The perimeter of the circular arc D∩(p+rS)de?nes the invariant

CA r(p):=

Z

p+rS 1D(x)d x=

d

dr

A r(p),(8)

(see Fig.1).The differential relation follows from(2).The name “Connolly function”is given to CA r(p)/r.It has been shown by [Cazals et al.2003]that there is the Taylor expansion

CA r=πr?κr2+O(r3).(9) By integrating(9),we get

A r=π

2

r2?

κ

3

r3+O(r4).(10)

This is a more precise estimate than A r≈r3arccos(rκ/2),which was given by[Manay et al.2004],in the sense that these two ex-pressions have different Taylor expansions as r→0.

It is worth noting how the behaviour of both the area invariant and the Connolly function changes if the curve under consideration is not smooth.Of course,formulas(9)and(10)are useless.Sup-pose that the curve c is still smooth,but consists of two curvature continuous pieces joined together at the point p.If left and right limit curvatures have valuesκ?andκ+,then Equation(9)is obvi-ously still valid,with the arithmetic mean of the left and right hand curvature instead ofκ.If the curve is not even smooth,but piece-wise smooth with an opening angleαdifferent from180degrees, then the perimeter of the circular arc which lies inside the curve is shortened or lengthened accordingly,and we arrive at

CA r=αr?κ?+κ+

2

r2+O(r3),(11)

A r=α

r2?

κ?+κ+

r3+O(r4),(12)

where the second equation is found by integrating the?rst one.The caseα=πandκ?=κ+=κyields the smooth case.

4B The gradient of the area functional

Following the general discussion of Section2C,we are interested in the change of the area invariant A r(p),if the point p varies.We pick a direction d and consider A r(p+d).Figures2.(a)–(d)show the change in area in?icted by the change in p:We have

A r(p+d)?A r(p)=L d· d +O( d 2),(13) where L d is the apparent length of the curve segment c∩(p+rB) when viewed from direction d(see Fig.2).

Denote the two points of intersection of the circle p+rS with the curve c by c?r,c+r,and consider the chord vector

c r(p)=c+r?c?r.(14) With the symbol c⊥for a rotation about90degrees,the apparent length L

d of th

e curve segment visible in Fig.2is now expressed as L d= c⊥r,d

d

.This leads to the following theorem:

Theorem1The gradient of the area invariant A r(p)with respect to p is obtained by rotating the chord vector about90degrees.The gradient and its norm are expressed by

?p A r=c⊥r=(c+r?c?r)⊥,(15)

?A r(p) =2r?

κ2

4

r3+O(r4).(16)

Proof.The discussion preceding the theorem implies that the change in area is?A r(p)= c⊥r,d +O(2),so the area gradient equals c⊥r.For the computation of ?A r = c+r?c?r we use the Frenet frame associated with the point p and the coordinates of c+r and c?r given by Section3A:We get

c r=(2r?κ2r3/4+O(r4),O(r3))T(17) an

d comput

e the norm o

f the gradient: c⊥r = c =[(2r?κ2r3/4+O(r4))2+O(r6)]1/2=2r[1?κ2r2/4+O(r4)]1/2= 2r(1?κ2r2/8+O(r4)),by the binomial series. The proof of Theorem1shows a phenomenon which occurs often when computin

g wit

h Taylor expansions:The x1coordinate of the vector c r is known up to third order,whereas the x2coordinate has only the general term O(r3)there.It would appear that we cannot compute the norm up to third order at all.Nevertheless,the computation shows that the third order term in the x2coordinate is irrelevant.

5Simple invariants for surfaces

5A The volume and surface area descriptors

3D counterparts of the invariants A r(p),CA r(p)are the volume descriptor V r(p)and the surface area descriptor SA r(p)of a point p on the boundary surface of a domain D:

V r(p)=

Z

p+rB

1D(x)d x,(18) SA r(p)=

Z

p+rS

1D(x)d x=

dV r(p)

.(19)

The relation of these quantities to mean curvature is discussed in [Hulin and Troyanov2003]and[Pottmann et al.2007]:

V r=

3

r3?

πH

4

r4+O(r5),SA r=2πr2?πHr3+O(r4).

(20)

A r,d

d

(p+rS)∩Φreference plane

Figure3:The apparent area A r,d enclosed by a space curve(p+ rS)∩Φwhen seen in direction of the vector d is found as area enclosed by the planar curve which arises when projecting the given space curve onto a reference plane orthogonal to d.The area is endowed with a sign,depending on the orientation of the boundary curve.With the area vector a r,we have A r,d= a r,d/ d . The normalized sphere area descriptor SA r/r2has been introduced by Connolly[Connolly1986]for molecular shape analysis.For an application in the same?eld it has been studied by[Cazals et al. 2003].

Equation(20)can be used to estimate the mean curvature.We de-?ne the mean curvature estimators e H r(p)and H e r(p)at scale r by deleting higher order terms in the Taylor expansions in(20):

e H r(p)=8?4V r(p),H e r(p)=2?SA r(p).(21)

In the limit r→0,both e H r(p)and H e r(p)tend to the actual mean curvature H(p).

Like in the curve case,we would like to study the behaviour of the volume descriptor for surfaces which are only piecewise smooth and piecewise curvature-continuous.Consider a point p at a sharp edge,where two smooth surface patches meet.The open-ing angle of that edge shall beα.In the smooth case(no edge),α=π.Clearly,the Taylor series of the volume descriptor starts with2αr3/3,but the higher order terms are not so obvious.A more detailed analysis shows that the curvature of the edge relative to the adjoining surfaces is irrelevant for the r4term,and that the volume

descriptor has the form V r=2α

3r3?π(H?+H+)

8

r4+O(r5).Here

H+and H?are the mean curvatures to either side of the edge.The case of a sharp corner is more complicated.

5B The gradient of the volume functional

We are now interested in the gradient?V r(p)of the volume de-scriptor with respect to p.We consider the surfaceΦwhich is the boundary of the domain D.As in Section4B,we choose a direc-tion d and investigate the difference V r(p+d)?V r(p).The2D counterpart of this analysis is illustrated by Fig.2:the difference of volumes is given by

V r(p+d)?V r(p)=A r,d d +O( d 2),(22) where A r,d is the apparent oriented area of the surface patchΦ∩B r(p)when viewed from the direction d.This area is the same as the oriented area enclosed by the projection of the closed curve c r=Φ∩?B r(p)onto any plane which is orthogonal to d.Let c r(u)be a parameterization of this curve c r on the sphere S2r(p). We consider its area vector

a r(p)=

1

2

I

c r

x×d x=

1

2

Z

I

c r(u)×˙c r(u)du.(23)

It is well known that the apparent area A r,d can be expressed as A r,d= a r(p),d

d

,which leads to?V r(p)= a r(p),?p + O(2).

Theorem2The gradient of the volume descriptor V r(p)with re-spect to the point p is the area vector a r(p),whose de?nition in terms of the intersection curveΦ∩(p+rS)is given by Equation (23):

?V r(p)=a r(p).(24) If n(p)is a unit normal vector of the surfaceΦin the point p,which points towards the inside of the domain D,then the area vector has the following Taylor expansion:

a r(p)=π

h

r2?

3H2?K

8

r4

i

n(p)+O(r5).(25)

Proof.Equation(24)follows directly from the discussion preced-ing the theorem.In order to investigate the behavior of a r for r→0,we express the intersection curve c r in the principal frame associated with the point p,and we employ cylinder coordinates (ρ,φ,x3),such that x1=ρcosφ,x2=ρsinφ.The point of the curve c r which lies in the planeφ=const according to (4)is found by intersecting the curve x3=1

2

(κ1(ρcosφ)2+κ2(ρsinφ)2)+O(ρ3)with the circleρ2+x23=r.From the coordinates of c+(r)in Section3A we read off that this point in cylinder coordinates is given byρ(φ)=r?1

8

κ2n(φ)r3+O(r4),

x3(φ)=1

2

κn(φ)r2+O(r3),whereκn(φ)=κ1cos2φ+κ2sin2φ.When we return to Cartesian coordinates,we get a point c r(φ)of the intersection curve,and the area vector is computed

by integration:a r(p)=1

2

R

φ=0

[ρ(φ)cosφ,ρ(φ)sinφ,x3(φ)]T×

d

[ρ(φ)cosφ,ρ(φ)sinφ,x3(φ)]T.Carrying out this integration yields Equation(25).

6Invariants for curves in surfaces

Section4A dealt with the area invariant for a planar curve c,which arises as the boundary of a domain D.The area invariant A r(p) means that part of D whose distance from p does not exceed r. The same question can be asked if both the domain D and its boundary curve c are contained in a smooth surfaceΦ.We de?ne

A r(p,Φ):=Area((p+rB)∩Φ).(26) It is interesting that the Taylor expansion of this area invariant given by the following theorem does not feature surface curvatures in its ?rst two terms.

Theorem3The area invariant of a curve c contained in a smooth surfaceΦhas the Taylor expansion

A r(p,Φ)=

π

r2?

κg

r3+O(r4),(27) whereκg is the signed geodesic curvature of the curve c(i.e.,the curvature of the projection of c onto the tangent plane in the point p).

Proof.We use a coordinate frame with p as origin and x 3axis or-thogonal to Φ.Without loss of generality Φhas the parametriza-tion x 3=g (x 1,x 2).We use the notation g ,i =?g

?x i and ρ=p

x 21+x 2

2.As both the x 1and x 2axes are tangent to Φ,

g ,1=O (ρ),g ,2=O (ρ).The surface area differential equals d x =

q 1+g 2

,1+g 2,2dx 1dx 2=(1+O (ρ2))dx 1dx 2.

A domain D in the surface has a corresponding domain e D

in the x 1,x 2plane,which arises as projection of D .If the diameter of D

is of magnitude O (ρ2

),then the area of D ,which is computed as R e D

d x ,obviously equals R

e D dx 1dx 2+O (ρ4).It follows that we can compute the area invariant A r (p ,Φ)to an ac-curacy o

f O (ρ4),if we project the curve c under consideration into the x 1,x 2plane.The result now follows directly from Equation (10). We notice that the last paragraph of the precedin

g proof shows that the area of the surface patc

h Φ∩(p +rB )equals

A r (p )=r 2π+O (r 4),

(28)

(which is e.g.Equ.(21)of [Pottmann et al.2007]).

Remark 1The area invariant for curves in surfaces employs those points of the surface whose distance from the point p ,measured in Euclidean space,does not exceed r .We could also ask for the points whose distance,measured inside the surface Φ,does not exceed r .As it turns out,Theorem 3remains unchanged.The reason for this is that the area of a geodesic disk (i.e.,the points at distance ≤r from p )differs from the area of a Euclidean disk only by a term of magnitude O (r 4):According to the formulae of J.Bertrand and V .A.Puiseux (see p.127of [Strubecker 1969]),that area has the

expansion GA r =πr 2?π

12Kr 4+O (r 5).Here K is the Gaussian curvature of the surface.We should note that the cost of computing geodesic disks usually is too high to merit their use if all we want to compute is curvatures.

7Invariants from distance functions

In applications where we have access to a distance function,it

makes sense to employ this function or functions derived from it for the de?nition of integral invariants.We discuss several ways to do this.

7A Invariants composed from the signed distance

Let dist(x ,Φ)be the signed distance function associated with a sur-face Φ:dist(x ,Φ)is positive if x lies outside the domain bounded by Φ,and negative if x lies inside.The absolute value of the signed distance equals the distance from Φin the ordinary sense.We employ the general method of Equation (1)to de?ne the signed distance integral D r .Letting g (x )=dist(x ,Φ)and w (x )=1leads to

D r (p )=Z

p +rB

dist(x ,Φ)d x .(29)

The relation of these descriptors to shape characteristics is de-scribed as follows:

Theorem 4The signed distance integral D r (p )de?ned by Equa-tion (29)has the Taylor expansion D r =4πH 15

r 5+O (r 6).Here H is the mean curvature of the surface Φin the point p .

Proof.We consider the principal coordinate frame associated with the point p and the quadratic Taylor polynomial of the signed dis-tance function given by Equation (5).Obviously,D r =R rB `?

x 3+1(κ1x 21+κ2x 22)+O (ρ3)′d x ,with ρ=(x 21+x 22+x 23)1/2

.The volume integral of O (ρ3)over a volume of size O (r 3

)is bounded

by O (r 6).Computation of the integrals of the functions x 3,x 21,x 2

2?nally yields the expression for D r . Note that the descriptor D r is related to mean curvature,just as the volume descriptor,which moreover is more stable (see the discus-sion below).Figure 4illustrates the similarity between these two descriptors.The sphere integral SD r corresponding to D r by dif-ferentiation has the Taylor expansion 4πH 3

r 4+O (r 5)

.D 0.

8D 0.

4

D noise 0.

4

D noise

0.

8

V 0.

8V 0.4

Figure 4:Comparison of the descriptor D r derived from the signed

(un-squared)distance the volume descriptor V r .Both are related to mean curvature.From top left:D r for two different kernel radii;D r for two different kernel radii with arti?cial noise added;V r for two different kernel radii.It is clearly visible that all descriptors try to capture the same geometric property (in this case,mean curva-ture),and that the effect of adding noise is almost eliminated when choosing a bigger neighbourhood for computation.For the kernel ball size compared to the bunny,see Fig.5.

7B Invariants composed from the squared distance

We now use the square of the signed distance function for the de?-nition of integral invariants.We study the squared distance integral

D 2,r (p )=Z

p +rB

dist(x ,Φ)2d x ,(30)

and the corresponding squared sphere distance integral SD 2,r (p )

de?ned by integration over p +rS .The following theorem de-scribes their relation to the curvatures of the surface Φ.

Theorem 5The integral invariants D 2,r (p )and SD 2,r (p )have the Taylor expansions

D 2,r (p )=

4π15r 5

105(κ1?κ2)2r 7+O (r 8),(31)SD 2,r (p )=4π3r 4

?

π

15

(κ1?κ2)2r 6+O (r 7).(32)

Here κ1and κ2are the principal curvatures of the surface Φin the point p .

Proof.It turns out that in order to derive the ?rst two nontrivial terms of the Taylor polynomial of D 2,r (p )we need to know the Taylor polynomial of dist(x ,Φ)2up to order four,which can be obtained from a third order Taylor polynomial of dist(x ,Φ).We use the principal frame associated with the point p and write down a third order Taylor polynomial for the surface Φ,thus extending Equation (4):

x 3=12(κ1x 21+κ2x 22)+16X i +j =3d ij 0x i 1x j

2+O (4).(33)We are not interested in the geometric meaning of the coef?cients d ij 0.The 3rd order Taylor polynomial of the signed distance func-tion has the following general form:dist(x ,Φ)=?x 3+1

2(κ1x 21+κ2x 22)+1

6P i +j +k =3d ijk x i 1x j 2x k 3+O (4),where the coef?cients d ijk are taken from (33)in case k =0.This is because the zero level set of dist(x ,Φ)coincides with the surface described by (33).Once the surface is given,the coef?cients d ij 0are known,and it turns out that the remaining coef?cients d ijk for k =0can be com-puted by requiring the eikonal equation ?dist(x ,Φ) =1for the distance https://www.doczj.com/doc/6b15082894.html,paring coef?cients ?dist(x ,Φ) 2=1yields the following expressions for the distance and its square:dist(x ,Φ)=?x 3+12(κ1x 21+κ2x 22)+x 32

(κ21x 21+κ22x 2

2)

+16X i +j =3d ij 0x i 1x j

2+O (4),dist(x ,Φ)2

=x 23?x 3(κ1x 21+κ2x 22)?x 23(κ21x 2

1+

κ22x 2

2)

?x 33X i +j =3d ij 0x i 1x j 2+14

(κ1x 21+κ2x 22)2+O (5).Integration over the ball rB yields the formula for D 2,r ,and the

one for SD 2,r follows by differentiation.Note that the integrals involving the coef?cients d ij 0are zero. Theorem 5allows to de?ne estimators e k 2and k

e 2for the squared difference (κ1?κ2)2o

f principal curvatures.We neglect terms of higher order and let

e k 2(p )=1πr

7(28πr 5?105D 2,r (p )),(34)k

e 2(p )=1πr 6

(20πr 4?15SD 2,r (p )).(35)

7C The squared distance from curves in 2D and in 3D

The squared distance function of a planar curve has properties sim-ilar to the respective function associated with a surface.Thus it is

easy to repeat the discussion of Section 7B for the case of planar curves and derive an analogue of Theorem 5.The extension of this result to space curves is also not dif?cult,as shown below.Smooth space curves do not separate space into two components,so the dis-tance from a space curve is always considered to be nonnegative.

D 2,0.4D 2,0.8

SD 2,0.4SD 2,0.8

Figure 5:Geometry descriptors derived from the squared distance.

These ?gures illustrate the volume integrals D 2,r for two different kernel radii,and the surface integrals SD 2,r ,for the same kernel radii.The higher resolution in case of smaller kernel balls is clearly visible.These descriptors estimate the difference of principal cur-vatures.

Theorem 6If c is a planar or spatial curve,the squared distance integral D 2,r (p )is related to its curvatures via

Z

p +rB

dist(x ,c )2d x =

π4r 4?κ2π96

r 6+O (r 7)or Z

p +rB

dist(x ,c )2

d x =8πr 5?κ2πr 7

+O (r 8),

respectively.Here κis the curvature of c in the point p .

Proof.We use (3)as a starting point to derive a 3rd order Taylor

polynomial of the unsigned distance from the curve c .This is com-pletely analogous to the proof of Theorem 5.Its square yields the 4th order approximation of the squared distance:dist(x ,c )2

x 22

+κ2

(x 41

4?x 21x 22)?x 2(κx 21+κ 3

x 31).(36)

This formula is very similar to the corresponding formula for sur-faces given above.We integrate this expression over a disk of radius r and get the result for planar curves.

For a space curve c we use (6)to express the squared distance from c as the sum of squared distances from the developable surfaces Ψ1,Ψ2swept by the motion of a rotation-minimizing frame (r.m.f.)e 1,e 2,as discussed in Section 3C.In the point under consideration,we let the r.m.f.coincide with the Frenet frame,so that t ,e 1,e 2and

t,e2,e1are principal frames forΨ1,Ψ2,respectively,and these surfaces then have the principal curvatures(0,0)and(κ,0)(cf. [do Carmo1976]).

We now use the proof of Theorem5to get Taylor expansion of the distances fromΨ1andΨ2:dist(x,Ψ1)2=x23+(odd)+O(5)and dist(x,Ψ2)2=x22?κ2x22x21+κ2x41+(odd)+O(5).Here“odd”

means a linear combination of terms x i1x j

2x k3where at least one of

i,j,k is odd.Now(6)implies that

dist(x,c)2=x22+x23+κ2(x41

?x21x22)+(odd)+O(5).(37)

This expression is similar to(36),the only relevant difference being the x23term.Integration over the ball rB yields the desired result.

8Stability analysis

All invariants considered in this paper are obtained by integration rather than by differentiation,which lets us expect robust behaviour with respect to perturbations and noise–at least,a behaviour which is more robust than that of quantities computed by numerical dif-ferentiation.In this section we investigate this stability problem from a theoretical perspective.Experimentally,robustness proper-ties have been con?rmed by the successful usage of curvature mea-sures derived from integral invariants in algorithms for solving the kinematic registration problem(see e.g.[Gelfand et al.2005]),for establishing surface correspondences for3D puzzles(see[Huang et al.2006]),and others.

Let us start with some general remarks.Our integral invariants(de-scriptors)compute a value which is de?ned by a kernel ball and a given surface.Mostly only that part of the surface which lies inside the kernel ball enters the de?nition.We discuss how the descriptor value changes if either the kernel or the surface undergoes a pertur-bation.Clearly instead of moving the kernel ball,one could also move the surface in the opposite direction,so we con?ne ourselves to perturbations of the surface.Without loss of generality we con-sider only normal variations of the form

p?=p+δ(p)n(p),(38) where p is a point on the surface,n(p)is the unit normal vector of the point p and pointing outside(with respect to the domain D), andδ(p)is the amount of perturbation.

Figure6:Perturbation p?=p+δ(p)n(p)of a surfaceΦand its in?uence on the volume descriptor.Left:The volume?V between surface patchesΨandΨ?.Right:Correction volumes V corr.

8A Stability of the volume descriptor:Theory Stability computations for the volume descriptor are very much re-lated to the volume formula for a normal variation of a surface ac-cording to(38):IfΨis a part of the surfaceΦ,then the volume change‘directly overΨ’(see Fig.6)has the form

?V=

Z

Ψ

(δ?δ2H+

1

3

δ3K)d x.(39)

Here H,K are the mean and Gaussian curvatures,respectively. Note that?V is an oriented volume,asδcan be positive or neg-ative.The formula is valid only as long as the surface offsets are regular.

The surface area A r(p)inside the kernel ball p+rB,which has been computed in Equation(28),is used in the de?nition of a mean perturbationδr and a maximum perturbationδmax:

δr(p)=

1

A r(p)

Z

Φ∩(p+rB)

δ(x)d x,(40)

δmax=max

x∈Φ∩(p+rB)

|δ(x)|.(41)

Theorem7If a perturbationδ(x)is applied to a surfaceΦ,then the change in the volume descriptor V r(p)can be expressed in terms of mean curvature H,mean perturbationδr(p),and max-imum perturbationδmax.For a zero mean value perturbation(i.e.,δr=0),we have

|?V r|≤r2πδ2max

|H|+

|κ1|+|κ2|

4

+O(δmax)+O(r)

.

(42) In general,

?V r=r2π(δr+O(δ2max)+O(δr2)).(43)

Proof.The change in volume when a surface is perturbed,consists of the integral(39)over the surface patchΦ∩(p+rB),illustrated by Fig.6,left,together with the volume of the ring-shaped part illustrated by Fig.6,right(correction volume).Any cross section of this correction volume is triangle-shaped of?rst order.Its area is given by‘(baseline times height)/2’,i.e.,

A?(x)=δ(x)2cotω/2+O(δ3).(44) Here x is a point of the intersection curve c r=Φ∩(p+rS).The correction volume therefore reads

V corr=

I

c r

1

2

δ(x)2cotω(x)d x+O(r2δ3).(45)

We want to relate V corr to the mean curvature ofΦ.For that purpose,we note that Equ.(19)of[Pottmann et al.2007] gives the following parameterization of the curve c r:c r(φ)= (ρcosφ,ρsinφ,z),withρ=r+O(r3)and z=O(r2).By differentiating(4),we get the surface’s normal vector in the point c r(φ):n r(φ)=[?rκ1cosφ+O(r2),?rκ2sinφ+O(r2),1]T. The intersection angleω(φ)between surface and sphere then obeys sinω(φ)=? n r(φ),c r(φ) / n r(φ) c r(φ .By some simple computations it follows that

cotω(φ)=

r

2

(κ1cos2φ+κ2sin2φ)+O(r2).(46)

The arc length differential of the curve c r(φ)reads ds=(1+ O(r2))dφ.We get

V corr=

Z2π

δ2

2

`r

2

(κ1cos2φ+κ2sin2φ)+O(r2)

dφ+O(·)≤δ2max

r2π

4

(|κ1|+|κ2|)+O(r3δ2max)+O(r2δ3max).

Another term which occurs in the computation of the volume change according to (39)is the integral R Ψδ2

H .If x is at dis-tance at most r from the midpoint p ,then H (x )=H (p )+O (r ).Therefore,

Z

Φ∩(p +rB )

δ2Hd x ≤δ2max r 2πH +O (δ2

max r 3).(47)

We have now collected suf?cient properties of the various integrals involved to show the statement of the theorem.The total volume change is bounded by |R

Φ∩(p +rB )(δ+δ2H +O (δ3)|+|V corr |.The dominant term equals the surface patch area r 2π(1+O (r 2))times mean perturbation –the dominant error term being the surface

integral of Hδ2.The latter is of order r 2δ2

max .In case the mean perturbation is zero,the volume change is dominated by R δH 2+V corr .Thus the theorem is proved.

Remark 2The results of Theorems 7and 2agree,which is seen as follows.The gradient vector of the volume descriptor is given by πr 2n (p )plus higher order terms,where n (p )is the normal vector of the surface under consideration.When evaluating the volume descriptor not for a boundary point p ,but for a point p +?p ,Theorem 2shows that the change in the volume descriptor approximately equals πr 2 n ,?p .The same value is also given by Theorem 7,since the change p →p +?p is equivalent to moving the surface by the amount of δr = ?p ,n in orthogonal direction.

8B Stability of the volume descriptor:Discussion

In order to assess the signi?cance of Theorem 7and also Theorem 2which is a special case,we study the effect of a surface perturbation

on the mean curvature estimator e H

de?ned by Equation (21).In case of a zero mean perturbation,we get

|?e H r |δr =0=4|?V r |

πr 4

≤(

δmax r

)2

(4|H |+|κ1|+|κ2|+O (r )+O (δmax )).(48)

The relative change in the mean curvature estimator consequently is given by

|?e H r |δr =0

max(κ1,κ2)≤(δmax r

)2(6+O (r )+O (δmax )).

(49)

We see that the stability expressed by Theorem 7and Equations (48),(49)is quite good,when we consider perturbations smaller than the kernel radius,i.e.,δmax /r 1.Zero mean perturbations occur e.g.in the form of noise,and also as discretization artifacts.The stability encountered here is the best for curvature estimators so far.

In the case of a systematic component in the perturbation (i.e.,nonzero mean δr (p )),the change in the mean curvature estimator has the following form:

?e H r ≤

4r δr +O (δ2

max

)+O (δr r 2)r

=??e H e H

≤4e H

?1r “δr +O (δ2max )r +O (rδr )”.

This shows that the descriptor e H

is stable against perturbations of magnitude δr ,if the following two conditions hold:

–(i)δr is small compared to the kernel radius r ;and

–(ii)the estimated mean curvature radius e H ?1is of the same mag-nitude or smaller than r .

If e H

is employed in feature recognition procedures,then a region of higher mean curvature,i.e.,a feature ,is more likely to persist through perturbations than a non-feature.This behaviour is exactly what is needed from a robust curvature estimator.

Remark 3The signi?cance of the stability inequalities presented here lies in the fact that robustness against perturbations is quan-ti?ed in terms of the magnitude of the perturbation alone,without reference to the perturbation’s derivatives.

Remark 4This allows to draw a further conclusion:If a real data set can in theory be seen as a perturbation of a much smoother one,then the previous paragraphs apply.Therefore,the mean cur-vature estimator e H

de?ned via a certain kernel radius r actually measures,with the bounds given above,the mean curvature of this hypothetic smooth surface.

8C Stability of the sphere area descriptor:Theory

The sphere area descriptor SA r (p )is the derivative of the volume descriptor V r (p )with respect to the kernel radius r and thus cannot be expected to have the same amount of stability.One source of instability is a possibly near-tangential intersection between surface and kernel sphere in case of a kernel radius which is of the same magnitude or smaller than the curvature radii of the surface.If this intersection angle “ω”is known,the deviation of the inter-section curve from its unperturbed state can be quanti?ed.In the limit r →0,the intersection angle tends to 90degrees,but in gen-eral it is unknown.Nevertheless,we ?rst consider the deviation δc of the intersection curve as if ωwere known.The reason for that is that a bound on the maximum curve perturbation δc,max leads to a reasonable bound on the perturbations in?icted on the sphere area descriptor.By elementary geometry,

δc (x )=

δ(x )

sin ω

+O (δr 2).(50)

As the kernel radius tends to zero,Equation (46)together with

1/sin ω=√1+cot 2ωimplies that δc (x )≈δ(x )`1+

r 2

4

(κ1cos 2φ+κ2sin 2φ)2′,where φis the polar angle associ-ated with the intersection point x .We conclude that

δc,max ≤δmax (1+O (r 2))(r →0).

(51)

Note that the previous equation applies only in the limit,and that

the magnitude of the quadratic terms depends on the curvatures of the surface.

Theorem 8A perturbation δ(x )of the given surface causes the intersection curve c r to move sideways by an amount δc (x ),the mean value of which is denoted by δc .The sphere area descriptor SA r (p )changes via

|?SA r (p )|ˉδc =0≤

πrδ2c,max

“|H |

2+O (r )+O (δc,max )”

(52)?SA r (p )=2πrδc `1+O (r 2)+O (δc,max )

depending on whether we have zero mean noise (δc =0)or a sys-tematic error (δc =0).Here H is the mean curvature.As r →0,replacing the curve perturbation δc by the surface perturbation δin formula (52)causes ?SA r to be multiplied by a factor of mag-nitude 1+O (r 2).

Proof.We consider an arc length parametrization c r (s )of the in-tersection curve c r ,and associate the Darboux frame {t ,e 2,n }with it (see Section 3D).As we use a coordinate system where the center of the kernel sphere is the origin,the normal vector n (x )

simply equals ?1r x .It follows that ˙n =1

r ˙c

,i.e.,in the notation of Section 3D,κn =?1/r and τg =0.The perturbation causes c (s )to move to the point e c (s ),which has the general form

?c

(s )=c (s )cos δs (s )+r e 2(s )sin δs (s ),where the amount of perturbation is not expressed in terms of chord length (that would be δc )but rather in terms of a polar angle δs .Obviously we have rδs =δc of ?rst order,and we also have δc ≤rδs .The exact relation follows from expanding the de?nition

δc (s ):= e c (s )?c (s ) and reads δc (s )=rδs (s )(1+O (δ2

c )).The change in surface area now is the oriente

d area of th

e spherical domain parametrized by x (s,v )=cos v c (s )+r sin v e 2(s ),for s ∈[0,L r ]and v ∈[0,δs (s )].The surface area element can be written as

dA =det(n ,x s ,x v )dvds

=det(n ,t cos v +rκg t sin v,?c sin v +e 2r cos v )dvds

=(r cos 2v ?r 2κg sin v cos v )dvds

(subscripts indicate differentiation,and we have used the formu-lae of Section 3D).It follows that the change in surface area

?SA r (p )=R L r s =0R δs (s )

v =0

dA equals ?SA r (p )=I c r

h

r sin 2δs +2δs 4?r 2

κg 1?cos 2δs 4i ds

=

I c r h rδs ?r 2κg δ2

s 2+O (rδ3

s )i ds.Here we have terminated the sine and cosine series at their quadratic terms.The Gauss-Bonnet theorem H κg =2π?SA r /r 2

and the

Taylor expansion SA r =2πr 2?πHr 3+O (r 4

)together imply that H r 2κg =πHr +O (r 2

).As to H rδs we note that according to Equ.(25)of [Pottmann et al.2007],the perimeter of the path of integration equals L r =2πr +O (r 3),and the mean value δc is de-?ned to equal 1L r

H δc .Thus,H rδs

=H δc (1+O (δ2c ))=2πr (1+O (r 2))(δc +O (δ3c,max ))=2πrδc +O (rδ3c,max )+δc O (r 3

).By summing up the cases δc =0and δc =0we get Equa-tions (52).By (51)and the discussion preceding that formula,δc,max =δ(1+O (r 2)),so the statement about the limit case r →0follows.

8D Stability of the sphere area descriptor:Discussion

In order to investigate how good or bad the inequalities (52)are,we now consider robustness from the viewpoint of the curvature esti-mator H

e r ,which is based on the descriptor SA r .A perturbation o

f the surface Φcauses a change ?H e r =?SA r /πr 3.Consequently,|?H e r |δ=0

≤1`δc,max ′2+···,

?H e r

=2δc H ?1

+···,(53)

where higher order terms are not written down.These equations show that the robustness inherent in the sphere area descriptor is nominally the same as for the volume descriptor (see Section 8B).The difference is that we use the perturbation δc of the intersection curve instead of the surface perturbation δ.Only asymptotically,δc ≈δ.

8E Stability of the squared distance integral

So far we have considered stability only for invariants which are

related to mean curvature.Fortunately,the squared distance integral D 2,r which has a relation not to mean curvature,but to κ1?κ2,also exhibits suf?cient stability for practical purposes.If the perturbed surface Φ?is at distance ≤ from the original surface Φ,then obviously |dist(x ,Φ?)?dist(x ,Φ)|< .With the implication |d ?d ?|≤ =?|d 2?d ?2|=|d ?d ?|(d +d ?)≤ (2d + )the difference of squared distance integrals with respect to Φand Φ?reads

?D 2,r (p )≤ Z

p +rB

(2|dist(x ,Φ)|+ )d x =2 D +

r + 24πr 33

.

Here the quantity D +

r is the integral of the unsigned distance func-tion over the kernel ball.It would not be hard to relate it to cur-vatures,using the Taylor expansion of the signed distance function given in this paper,and the general method,presented by [Pottmann et al.2007],of integrating functions over that part of a kernel ball which lies to one side of the given surface.However,it is obvious

that the dominant term in D +

r is given by the integral of |x 3|over

the kernel ball rB ,i.e.,πr 4

2

.We investigate the effect of a surface perturbation in the geometry descriptor e k ,which is based on D 2,r ,and which estimates |κ1?κ2|.From (34)we get

?(e k 2)≈?D 2,r (p )105πr 7≈105r 2

`

r +43( r

)2′.(54)

As e k estimates a difference in curvatures,it has to be compared to

the curvature of the kernel sphere,i.e.,r ?1.We therefore rewrite the previous equation as

?(e k 2)(0.0975r )?2≈

r `

1+43 r

′.(55)

Again,we consider perturbations with r .We see that the right

hand side is bounded in terms of /r .In contrast to the mean cur-vature estimators e H

and H e ,the robustness inequality for e k relates the change in the geometry descriptor to the kernel radius,and not to the value of the geometry descriptor itself.

Another difference to the geometry descriptors derived from vol-ume and sphere area is that here the case of zero mean noise (ˉδ

=0)does not lead to better robustness.This is easily explained from the fact the perturbation in?icted on the distance ?eld associated with the surface essentially depends on the mean of |δ|and not on the mean of δ(see Fig.7).

Even if we can give bounds for the effect of noise and perturba-tions,invariants which involve the distance function are generally less stable than those which integrate just the indicator function.

9Computation of integral invariants

Throughout the paper we maintain the notion that the curves and surfaces under consideration are the boundary of some domain D .This appears to restrict discussion to closed curves and surfaces.All open curves and surfaces however locally occur as part of the boundary of some domain,so this assumption is not a real restric-tion.Implementing the computation of integral invariants for such ‘open’curves and surfaces does not differ in essential ways from

The computation of integral invariants for discrete surfaces needs appropriate data structures for preprocessing,as well as intelligent ways of discretizing integrals.We approach this problem in three different ways,each of them being suitable for certain kinds of in-tegral invariants.These are an FFT-based method (Section 9A),an octree based method (Section 9B),and a triangulation based method (Section 9C).We will discuss applications in Section 10.

9A Computing invariants with FFT

The general form of an integral invariant I r (p )as de?ned by (1)

can be written in convolution notation.We use the notation 1rB for the indicator function of the ball r ·B and write

k (x )=w (x )·1rB (x )=?

I r (p )=

Z

R 3

g (x )k (p ?x )=(g k )(p ).(56)

Into this category fall the invariants V r ,D r ,D 2,r ,and also the invariants employed in principal component analysis by [Pottmann et al.2007].An obvious way to evaluate integral invariants would be to approximate these continuous convolutions by discrete ones and employ FFT for them.This method is also described by [Yang et al.2006].Here we are going to show a modi?cation of this simple procedure which yields a better approximation of the continuous convolution.

In our setting,functions are typically only known at grid points j ∈Z 3with integer coordinates j =(j 1,j 2,j 3),however we ‘know’that they are smooth or have at least smooth level sets.Of course,the continuous convolution f g can be approximated by the discrete convolution de?ned by (f g )(k )=P j ∈Z 3f (j )g (k ?j ).We will not use this simple approximation,but rather de?ne contin-uous functions from discrete data and show to evaluate their contin-uous convolution using the discrete one.Discrete convolutions are computed with FFT.

One way to de?ne a continuous function g (x )from discrete data g (j )is to interpolate between the grid points by letting

g (x )=

X

j

g (j )K (x ?j ),where (57)

K (x )=b (x 1)b (x 2)b (x 3),b (ξ)=max(0,1?|ξ|).

C 1

Figure 8:Integral invariant computation based on an octree data structure.The cubes C 1,C 2,C 3correspond to cases 2c α,2b,and 2c βof Algorithm 1,respectively.

The convolution of (56)now takes the form

(g k )(p )=Z X

j

g (j )K (x ?j )k (p ?x )d x

=X

j g (j )Z K (y )k (p ?y ?j )d y

=X j

g (j )(K k )(p ?j )=(g (K k ))(p ).

The discrete Fourier transform of K k ,which is needed here,can

be precomputed.

The function in the de?nition of the integral invariant may coin-cide with the indicator function 1D of the domain D (in case of the volume descriptor).Knowledge of all values g (j )for integer grid points j then means that the domain D is voxelized and given as an occupancy grid.We refer to [Gelfand et al.2005]for more details on the computation of occupancy grids via scan conversion (see e.g.[Nooruddin and Turk 2003]).For the invariant D r ,the func-tion g is the signed distance from the surface under consideration,and for the invariant D 2,r ,we use the square of that distance func-tion.Distance ?elds can be computed in various ways;we used fast sweeping (see e.g.[Danielsson 1980],[Kimmel et al.1996],[Tsai et al.2003],[Zhao 2005],[Kao et al.2005]).

When we employ FFT for computing discrete convolutions,we ac-tually compute many more values than are necessary,because inte-gral invariants are only evaluated at boundary points of the domain D .In order to reduce computational costs,we invoke convolution not for a single bounding box of D ,but for a sequence of boxes which cover the boundary ?D .We estimate that for box size b the cost of each convolution equals C (b,r ):=N (b,r )3log N (b,r )with N (b,r )=b +2r .The total cost then equals C (b,r )times the number of boxes,i.e.,is proportional to C (b,r )/b 2.Minimiz-ing this function leads to an optimal box size of b opt (r )≈2.28r ,which for practical purposes gets rounded up such that we apply FFT to a box whose size is a power of two.

9B An octree based method for computing invariants

An advantage of the FFT method is its simplicity.Disadvantages are that even with an optimized box size we still compute many values which do not interest us,and most importantly,that we can

evaluate integral invariants only at grid points.This section de-scribes a data structure which yields a new way of evaluating inte-gral invariants for the actual surface points.

We decompose an appropriate bounding box of the given surface into a hierarchical collection (an octree)of cubes,such that the function g (x )of Equation (1)is suf?ciently well approximated by a quadratic function e g i in each leaf cube.This approach works well if the function w in Equ.(1)is constant.An example of such a de-composition,with the purpose of computing the volume descriptor,is illustrated by Fig.8.

Given a decomposition of space into cubes C i ,we write the integral of Equation (1)as follows:

M r i,p :=C i ∩(p +rB )=

?I r (p )=X i :C i ?(p +rB )

`

Z C i

g ′+X i :M r

i,p

=

?,C i ?(p +rB )

`

Z

M r i,p

g ′

.

It is the aim of our data structure to eliminate integrals of the sec-ond kind and adaptively decompose space such that the majority of

computations is for integrals of the ?rst type.This is because their values can be precomputed.Integrals of the second kind are com-puted via the previously obtained approximations e g i in each leaf cube C i .

We now describe the three main parts of our method:octree con-struction,preprocessing,and computation of integral invariants.We focus on the cases g =1D (so I r (p )is the volume descriptor)and the squared distance function.

In the case g =1D ,we construct the octree using a scan conver-sion method if ?D is given as a triangle mesh (cf.[Nooruddin and Turk 2003;Ju 2004]),and the method of [Frisken et al.2000]if it is a point cloud.The function e g i which approximates the indicator function 1D in each cube is chosen as a constant,which indicates to which extent the cube C i lies inside D .As cubes which con-tain the boundary ?D are very small anyway,this is a reasonable simpli?cation.

For computing integral invariants based on the squared distance,we have g (x )=dist(x ,?D )2.In our examples,the values of g (x )have been obtained by fast sweeping (cf.[Tsai et al.2003;Zhao 2005;Kao et al.2005]).Then we use the procedure of [Mitra et al.2004]to determine the decomposition of space into cubes C i such that within each leaf cube C i ,the squared distance is approximated by quadratic functions e g i .After the octree has been constructed,we compute the integrals of the function g over each leaf cube C i ,using the approximation e g i ,and then propagate these values to obtain the integrals of the func-tion g over the remaining cubes.The computation of I r (p )runs as sketched in Algorithm 1.

The different types of cubes are illustrated by Figure 8.The most costly operation obviously is to integrate the function e g i over the domain C i ∩(p +rB )in 2c α.This is made easier by the fact that the functions e g i are actually quadratic.When computing the volume invariant,such that this integral equals the volume of C i ∩(p +rB )∩D ,the boundary of D can be replaced by its tangent plane if C i is small.

9C Computing surface integrals

For the computation of invariants de?ned by an area integral over the sphere,we employ triangulations of the sphere,and take care of the boundary of the spherical patch we are integrating on.This method is described by [Yang et al.2006]and [Pottmann et al.2007],so we do not give details here.

1.Initialize C i with the root cube;let I =0.

2.For the cube C i ,perform the following computations:

2a.If C i is outside p +rB ,do nothing.2b.Else if C i ?(p +rB ),increase I by the value

R C i e g i

,which is precomputed.2c.Else:

(α)If C i is a leaf cube,increase I by the value

R C i ∩(p +rB )e g i

.(β)Else,call 2.for all 8child cubes of C i .

3.I contains the result.

Algorithm https://www.doczj.com/doc/6b15082894.html,puting I r (p )based on the octree decomposition illus-trated by Figure 8.

9D Computational ef?ciency

Computation times for the bunny and dragon models from the Stan-ford collection are indicated in the table below.Here ‘preprocess-ing’for volume integrals means computing a grid structure which stores the characteristic function.For invariants computed by sur-face integration,a triangulation of the sphere with 13592triangles has been employed.The run times shown are for a 2GHz PC with 2GB RAM.For the volume integrals we have used the method of 9B,for the surface integrals the method of 9C.model bunny dragon #triangles

69451

104568

grid size for 1D 170×168×146194×156×124preprocessing 4.6s 4.4s computing V r 3.8s 3.7s computing SA r

9.7s

19.6s

As to the squared distance integral ,the preprocessing stage the dis-tance ?eld is computed (we used fast sweeping),takes longer than for the volume descriptor.In the case of the bunny (cf.the table above),this preprocessing step needed 10s.

The cost of computation of integral invariants at n different scales with the FFT method is not proportional to the cost of computing once,but roughly proportional to the cost of n +1FFTs. E.g.[Huang et al.2006]computed integral invariants for 8different radii for the parts of of Fig.10.This computation needed approximately 1minute for 400000vertices on a 1.4GHz PC with 512MB RAM.

10Applications

We think that integral invariants may be useful for every kind of computation or algorithm which makes use of shape characteristics,especially https://www.doczj.com/doc/6b15082894.html,ually the computation of such geometric properties via integral invariants is rather more robust with respect to perturbations and noise than other methods.For certain integral invariants this experimental result,for which we refer to [Yang et al.2006],is con?rmed by the theoretical investigations of the present paper.

A second property of integral invariants which make them valuable for applications is that they allow to compute at a certain scale r ,which for the current paper is identi?ed with the kernel ball radius.The nature of computation is such that surface features smaller than r are considered as noise and will be smoothed out.

There are several publications which deal with applications and comparison of methods,so we will not go into details here (one

Figure9:Feature extraction on multiple scales according to[Yang et al.2006].Integral invariants for several different kernel radii are used to identify features.Darker regions are classi?ed as features on all scales,lighter shaded regions correspond to features extracted at only one or two scales.At left:ravines;at right:ridges.The integral invariants used for this?gure are I r(x i x j)(i,j=1,2,3), whose properties are not discussed in the present paper.

of these is[Yang et al.2006]).Figure9illustrates feature detection at multiple scales:ravines and ridges are detected by computing curvatures;and that curvature computation is done by evaluating integral invariants de?ned by a certain kernel ball of radius r.Fea-tures which persist for several values of r are considered to be de-tected with higher con?dence than those which are only detected for a small number of kernel ball radii.

Another application of integral invariants in general is the compu-tation of the network of principal curvature lines in a robust way by [Liu et al.2006].

A third and important application of integral invariants is the com-putation of shape characteristics for the purpose of kinematic reg-istration and establishing correspondences between surfaces.Such surfaces can be partially overlapping scan data of the same model –the task is then to merge these scans together in order to create a dataset of the entire object(cf.[Gelfand et al.2005]).Another in-stance where the kinematic registration problem occurs in the auto-matic reassembling of fragments of broken objects by[Huang et al. 2006].For this‘3D puzzle’problem(see Fig.10),each fragment is represented as a geometric model,e.g.,as a triangle mesh,but it is unknown a priori how the pieces?t together.The paper by[Huang et al.2006]describes a rather involved procedure which recognizes fracture surfaces and?nds correspondences between them in or-der to reestablish the lost connectivity of the original3D volume. This method relies heavily on the availability of independent and robustly computable geometry descriptors.A signi?cant number of the descriptors involved are integral invariants described in the present paper,namely V r(p)and D2,r(p),for a sequence of differ-ent values of the kernel radius r.

11Conclusion and future research

We analyzed geometry descriptors,which are capable of captur-ing shape characteristics,and which exhibit a multi-scale behaviour useful for recognizing persistent features.We discussed theoretical stability results which express again the numerical robustness of integral invariants already encountered in various algorithms.The volume descriptor exhibits the best stability,because compared to invariants based on surface integrals it is averaging over a greater domain,and compared to invariants based on distance functions it is averaging a function whose values which are not subject to noise.

1

1

2

3

4

5

6

e H e k

Figure10:Reassembling a broken brick.The top?gure shows all6pieces,5of them already put together.The?gures below shows piece No.6,with the values of an estimated mean curva-ture derived from the volume descriptor(at left),and an estimated difference between principal curvatures,derived from the squared distance descriptor.These shape characteristics are employed in order to distinguish fracture surfaces from the smoother surface of the original object,and then to establish correspondences between fracture surfaces for the purpose of automatic reassembling.This ?gure was taken from[Huang et al.2006].

Regarding computational ef?ciency,all invariants described in the present paper generate running times of the same magnitude.

We expect further applications where integral invariants can greatly improve robustness of algorithms.We would like to mention one area of future research which seems promising,namely shape sig-natures.They have been initiated by[Manay et al.2004].The sig-nature of a planar curve c is de?ned as set of points(I(p),I (p)), where p∈c,I is a certain integral invariant and I is its derivative with respect to arc length.In order to enhance robustness,we might want to avoid a derivative,but instead employ another integral in-variant I2.I2could be of the same type as I,only computed with respect to a different kernel ball radius.Ideally,the signature should characterize the shape within some tolerance up to rigid body mo-tions(or other transformations).We are not aware of any result in this direction.Clearly,all these investigations should eventually be performed for3D objects.

Acknowledgements

This research was supported by grants No.S9206and S9207of the Austrian Science Fund(FWF).

References

A LEKSANDROV,A.D.,AND Z ALGALLER,V.A.1967.Intrinsic

geometry of surfaces,vol.15of Translations of Mathematical Monographs.American Mathematical Society.

A LLIEZ,P.,C OHEN-S TEINER,D.,D EVILLERS,O.,L′E VY,B.,

AND D ESBRUN,M.2003.Anisotropic polygonal remeshing.

ACM Trans.Graphics22,3,485–493.Proc.SIGGRAPH.

A MBROSIO,L.,AND M ANTEGAZZA,C.1998.Curvature and

distance function from a manifold.J.Geom.Anal.8,723–748.

B AJAJ,C.,AND X U,G.2003.Anisotropic diffusion on surfaces

and functions on surfaces.ACM Trans.Graphics22,1,4–32.

B OBENKO,A.,AND P INKALL,U.1996.Discrete isothermic sur-

faces.J.Reine Angew.Math.475,187–208.

B OBENKO,A.,AND S CHR¨ODER,P.2005.Discrete Willmore?ow.

In Symp.Geometry Processing,Eurographics Assoc.,M.Des-brun and H.Pottmann,Eds.,101–110.

C AZALS, F.,AN

D P OUGET,M.2003.Estimating differen-

tial quantities using polynomial?tting of osculating jets.In Symp.Geometry Processing,Eurographics Assoc.,L.Kobbelt, P.Schr¨o der,and H.Hoppe,Eds.,177–187.

C AZALS,F.,C HAZAL,F.,AN

D L EWINER,T.2003.Molecu-

lar shape analysis based upon the Morse-Smale complex and the Connolly function.In SCG’03:Proc.19th Symposium on Com-putational Geometry,ACM Press,351–360.

C HEEGER,J.,M¨ULLER,W.,AN

D S CHRADER,R.1984.On the

curvature of piecewise?at https://www.doczj.com/doc/6b15082894.html,m.Math.Phys.92,405–454.

C LARENZ,U.,R UMPF,M.,S CHWEITZER,M.A.,AN

D T ELEA,

A.2004.Feature sensitive multiscale editing on surfaces.Visual

Computer20,5,329–343.

C LARENZ,U.,R UMPF,M.,AN

D T ELEA,A.2004.Robust feature

detection and local classi?cation for surfaces based on moment analysis.IEEE https://www.doczj.com/doc/6b15082894.html,p.Graphics10,5,516–524.

C OHEN-S TEINER,D.,AN

D M ORVAN,J.M.2003.Restricted

Delaunay triangulations and normal cycle.In Proc.19th annual symposium on Computational geometry,ACM,312–321.

C ONNOLLY,M.L.1986.Measurement of protein surface shape

by solid angles.J.Mol.Graph.4,1,3–6.

D ANIELSSON,P.-E.1980.Euclidean distance https://www.doczj.com/doc/6b15082894.html,puter

Graphics and Image Processing14,227–248.

DO C ARMO,M.P.1976.Differential Geometry of Curves and Surfaces.Prentice-Hall.

F RISKEN,S.F.,P ERRY,R.N.,R OCKWOOD,A.P.,AND J ONES,

T.R.2000.Adaptively sampled distance?elds:a general repre-sentation of shape for computer graphics.In Proc.SIGGRAPH, 249–254.

G ELFAND,N.,M ITRA,N.J.,G UIBAS,L.J.,AND P OTTMANN,

H.2005.Robust global registration.In Symp.Geometry Pro-

cessing,Eurographics Assoc.,M.Desbrun and H.Pottmann, Eds.,197–206.

G OLDFEATHER,J.,AND I NTERRANTE,V.2004.A novel cubic-

order algorithm for approximating principal direction vectors.

ACM Trans.Graphics23,1,45–63.

H ILDEBRANDT,K.,AND P OLTHIER,K.2004.Anisotropic?l-

tering of non-linear surface https://www.doczj.com/doc/6b15082894.html,puter Graphics Forum 23,3,391–400.Proc.Eurographics.

H ILDEBRANDT,K.,P OLTHIER,K.,AND W ARDETZKY,M.2005.

Smooth feature lines on surface meshes.In Symp.Geometry Processing,Eurographics Assoc.,M.Desbrun and H.Pottmann, Eds.,85–90.H UANG,Q.-X.,F L¨ORY,S.,G ELFAND,N.,H OFER,M.,AND

P OTTMANN,H.2006.Reassembling fractured objects by geo-metric matching.ACM Trans.Graphics25,3,569–578.Proc.

SIGGRAPH.

H ULIN,D.,AND T ROYANOV,M.2003.Mean curvature and

asymptotic volume of small balls.Amer.Math.Monthly110, 947–950.

J U,T.2004.Robust repair of polygonal models.ACM Trans.

Graphics23,3,888–895.Proc.SIGGRAPH.

K AO,C.-Y.,O SHER,S.,AND T SAI,Y.-H.2005.Fast sweeping methods for static Hamilton-Jacobi equations.SIAM J.Numeri-cal Analysis42,2612–2632.

K IM,S.-K.,AND K IM,C.-H.2005.Finding ridges and valleys in

a discrete surface using a modi?ed MLS https://www.doczj.com/doc/6b15082894.html,puter-

Aided Design37,1533–1542.

K IMMEL,R.,K IRYATI,N.,AND B RUCKSTEIN,A.M.1996.Sub-pixel distance maps and weighted distance transforms.J.Math.

Imaging and Vision6,223–233.

L IU,Y.,P OTTMANN,H.,W ALLNER,J.,Y ANG,Y.-L.,AND W ANG,W.2006.Geometric modeling with conical meshes and developable surfaces.ACM Trans.Graphics25,3,681–689.

Proc.SIGGRAPH.

M ANAY,S.,H ONG,B.-W.,Y EZZI,A.J.,AND S OATTO,S.2004.

Integral invariant signatures.In Proc.ECCV2004/IV,Springer, T.Pajdla and J.Matas,Eds.,vol.3024of Lecture Notes in Com-puter Science,87–99.

M EYER,M.,D ESBRUN,M.,S CHR¨ODER,P.,AND B ARR,A.

2002.Discrete differential-geometry operators for triangulated 2-manifolds.In Visualization and Math.III,Springer,H.-C.

Hege and K.Polthier,Eds.,35–57.

M ITRA,N.,G ELFAND,N.,P OTTMANN,H.,AND G UIBAS,L.

2004.Registration of point cloud data from a geometric op-timization perspective.In Symp.Geometry Processing,Euro-graphics Assoc.,R.Scopigno and D.Zorin,Eds.,23–32.

N OORUDDIN,F.S.,AND T URK,G.2003.Simpli?cation and repair of polygonal models using volumetric techniques.IEEE https://www.doczj.com/doc/6b15082894.html,p.Graphics9,2,191–205.

O HTAKE,Y.,B ELYAEV,A.,AND S EIDEL,H.-P.2004.Ridge-valley lines on meshes via implicit surface?tting.ACM Trans.

Graphics23,3,609–612.Proc.SIGGRAPH.

O SHER,S.,AND F EDKIW,R.2002.The Level Set Method and Dynamic Implicit Surfaces.Springer.

P INKALL,U.,AND P OLTHIER,https://www.doczj.com/doc/6b15082894.html,puting discrete min-imal surfaces and their conjugates.Experiment.Math.2,1,15–

36.

P OLTHIER,K.2002.Polyhedral surfaces of constant mean curva-ture.Habilitationsschrift TU Berlin.

P ORTEOUS,I.2001.Geometric Differentiation,2nd ed.Cam-bridge University Press.

P OTTMANN,H.,AND H OFER,M.2003.Geometry of the squared distance function to curves and surfaces.In Visualization and Mathematics III,Springer,H.-C.Hege and K.Polthier,Eds., 223–244.

P OTTMANN,H.,W ALLNER,J.,Y ANG,Y.-L.,L AI,Y.-K.,AND

H U,S.-M.2007.Principal curvatures from the integral invariant

https://www.doczj.com/doc/6b15082894.html,put.Aided Geom.Design24,428–442.

R AZDAN, A.,AND B AE,M.-S.2005.Curvature estimation scheme for triangle meshes using biquadratic B′e zier patches.

Computer-Aided Design37,1481–1491.

R UGIS,J.,AND K LETTE,R.2006.Surface registration markers from range scan data.In Combinatorial Image Analysis:11th int.workshop,R.Reulke et al.,Eds.,vol.4040of Lecture Notes Computer Science.Springer,430–444.

R USINKIEWICZ,S.2004.Estimating curvatures and their deriva-tives on triangle meshes.In3D Data Processing,Visualization and Transmission,2nd Int.Syposium.IEEE Computer Society, 486–493.

S PIVAK,M.1975.A Comprehensive Introduction to Differential Geometry.Publish or Perish.

S TRUBECKER,K.1969.Differentialgeometrie:Theorie der Fl¨a-chenkr¨u mmung,vol.1180of Sammlung G¨o schen.De Gruyter, Berlin.

T AUBIN,G.1995.Estimating the tensor of curvature of a surface from a polyhedral approximation.In https://www.doczj.com/doc/6b15082894.html,puter Vision,902–907.

T ONG,W.-S.,AND T ANG,C.-K.2005.Robust estimation of adaptive tensors of curvature by tensor voting.IEEE Pattern Anal.Machine Intell.27,3,434–449.

T SAI,Y.-H.R.,C HENG,L.-T.,O SHER,S.,AND Z HAO,H.-K.

2003.Fast sweeping algorithms for a class of Hamilton-Jacobi equations.SIAM J.Numerical Analysis41,2,659–672.

V AN G OOL,L.J.,M OONS,T.,P AUWELS,E.,AND O OSTER-LINCK,A.1992.Semi-differential invariants.In Geometric invariance in computer vision,J.L.Mundy and A.Zisserman, Eds.MIT Press,157–192.

Y ANG,Y.-L.,L AI,Y.-K.,H U,S.-M.,AND P OTTMANN,H.

2006.Robust principal curvatures on multiple scales.In Symp.Geometry processing,Eurographics Assoc.,K.Polthier and A.Sheffer,Eds.,223–226.

Y OKOYA,N.,AND L EVINE,M.D.1989.Range image segmen-tation based on differential geometry:a hybrid approach.IEEE Trans.Pattern Anal.Machine Intell.2,6,643–649.

Z HAO,H.2005.Fast sweeping method for eikonal equations.

Mathematics of Computation74,603–627.

[批处理]计算时间差的函数etime

[批处理]计算时间差的函数etime 计算时间差的函数etime 收藏 https://www.doczj.com/doc/6b15082894.html,/thread-4701-1-1.html 这个是脚本代码[保存为etime.bat放在当前路径下即可:免费内容: :etime <begin_time> <end_time> <return> rem 所测试任务的执行时间不超过1天// 骨瘦如柴版setlocal&set be=%~1:%~2&set cc=(%%d-%%a)*360000+(1%%e-1%%b)*6000+1%%f-1% %c&set dy=-8640000 for /f "delims=: tokens=1-6" %%a in ("%be:.=%")do endlocal&set/a %3=%cc%,%3+=%dy%*("%3>> 31")&exit/b ---------------------------------------------------------------------------------------------------------------------------------------- 计算两个时间点差的函数批处理etime 今天兴趣大法思考了好多bat的问题,以至于通宵 在论坛逛看到有个求时间差的"函数"被打搅调用地方不少(大都是测试代码执行效率的) 免费内容: :time0

::计算时间差(封装) @echo off&setlocal&set /a n=0&rem code 随风@https://www.doczj.com/doc/6b15082894.html, for /f "tokens=1-8 delims=.: " %%a in ("%~1:%~2") do ( set /a n+=10%%a%%100*360000+10%%b%%100*6000+10%% c%%100*100+10%%d%%100 set /a n-=10%%e%%100*360000+10%%f%%100*6000+10%%g %%100*100+10%%h%%100) set /a s=n/360000,n=n%%360000,f=n/6000,n=n%%6000,m=n/1 00,n=n%%100 set "ok=%s% 小时%f% 分钟%m% 秒%n% 毫秒" endlocal&set %~3=%ok:-=%&goto :EOF 这个代码的算法是统一找时间点凌晨0:00:00.00然后计算任何一个时间点到凌晨的时间差(单位跑秒) 然后任意两个时间点求时间差就是他们相对凌晨时间点的时间数的差 对09这样的非法8进制数的处理用到了一些技巧,还有两个时间参数不分先后顺序,可全可点, 但是这个代码一行是可以省去的(既然是常被人掉用自然体

表情符号大全

表情符号大全 ?new news?new news? ???????????● ?●?????????????????♂♀????????⊙◎?????????????????????◇?????の★☆→あぃ£Ю〓§???¤????????≈???.. ..????? ???????? ~.~??-????【】┱┲?????????????????????????????????★☆??⊙????????╬『』∴? .??????????☆∷﹌の★◎??????

??????↘??▄█▌????????????????の☆→ ?ぃ£?????????????????????????????????????????????????????????????????????????????????????*????????????????????????o(?\'\'\'?)o?べò????????????べ?????????:基本符号?.1 ⊙●○①⊕◎Θ⊙¤㊣★☆♀◆◇◣◢◥▲▼△▽⊿◤◥?.2▆▇█ █ ■ ▓ 回□ 〓≡ ╝╚╔

╗╬ ═ ╓ ╩ ┠┨┯┷┏?.3┓┗┛┳⊥『』┌ ┐└ ┘∟「」↑↓→←↘↙♀♂┇┅﹉﹊﹍﹎╭?.4╮╰╯*^_^* ^*^ ^-^ ^_^ ^(^ ∵∴‖||︴﹏﹋﹌()〔〕?.5【】〖〗@:!/ " _ < > `,·。≈{}~ ~() _ -『』√ $ @ * & # ※?.6卐々∞Ψ ∪∩∈∏ の℡ぁ§∮”〃ミ灬ξ№∑⌒ξζω*?.7.·°∴☆..·°?Yesterday ?.·°?.8?KicaZ宝贝o(╥﹏╥)o ??じ☆ve 【??????】*°^_^.......???.9 ┢┦aΡpy ?^_^??????ぜ长ヤ乷?????Cool Friends??????.10【】—一▄【┻┳═一▄【┳一▄【┻═┳一▄【┳-一?.11 ▄【┻═

用c++编写计算日期的函数

14.1 分解与抽象 人类解决复杂问题采用的主要策略是“分而治之”,也就是对问题进行分解,然后分别解决各个子问题。著名的计算机科学家Parnas认为,巧妙的分解系统可以有效地系统的状态空间,降低软件系统的复杂性所带来的影响。对于复杂的软件系统,可以逐个将它分解为越来越小的组成部分,直至不能分解为止。这样在小的分解层次上,人就很容易理解并实现了。当所有小的问题解决完毕,整个大的系统也就解决完毕了。 在分解过程中会分解出很多类似的小问题,他们的解决方式是一样的,因而可以把这些小问题,抽象出来,只需要给出一个实现即可,凡是需要用到该问题时直接使用即可。 案例日期运算 给定日期由年、月、日(三个整数,年的取值在1970-2050之间)组成,完成以下功能: (1)判断给定日期的合法性; (2)计算两个日期相差的天数; (3)计算一个日期加上一个整数后对应的日期; (4)计算一个日期减去一个整数后对应的日期; (5)计算一个日期是星期几。 针对这个问题,很自然想到本例分解为5个模块,如图14.1所示。 图14.1日期计算功能分解图 仔细分析每一个模块的功能的具体流程: 1. 判断给定日期的合法性: 首先判断给定年份是否位于1970到2050之间。然后判断给定月份是否在1到12之间。最后判定日的合法性。判定日的合法性与月份有关,还涉及到闰年问题。当月份为1、3、5、7、8、10、12时,日的有效范围为1到31;当月份为4、6、9、11时,日的有效范围为1到30;当月份为2时,若年为闰年,日的有效范围为1到29;当月份为2时,若年不为闰年,日的有效范围为1到28。

图14.2日期合法性判定盒图 判断日期合法性要要用到判断年份是否为闰年,在图14.2中并未给出实现方法,在图14.3中给出。 图14.3闰年判定盒图 2. 计算两个日期相差的天数 计算日期A (yearA 、monthA 、dayA )和日期B (yearB 、monthB 、dayB )相差天数,假定A 小于B 并且A 和B 不在同一年份,很自然想到把天数分成3段: 2.1 A 日期到A 所在年份12月31日的天数; 2.2 A 之后到B 之前的整年的天数(A 、B 相邻年份这部分没有); 2.3 B 日期所在年份1月1日到B 日期的天数。 A 日期 A 日期12月31日 B 日期 B 日期1月1日 整年部分 整年部分 图14.4日期差分段计算图 若A 小于B 并且A 和B 在同一年份,直接在年内计算。 2.1和2.3都是计算年内的一段时间,并且涉及到闰年问题。2.2计算整年比较容易,但

批处理命令行for语句

for语句可以在命令行提示符中使用,也可以在批处理文件中使用。这两种情况下唯一的区别是%和%%,参加下文说明。 一、for语句的格式: for [参数] 变量in (集合) do 命令[命令的参数] 二、for语句的作用:对集合内的元素逐一执行后面的命令。 1、如:for %%i in (你好) do echo %%i 将在屏幕上显示“你好”2个字。这里集合是“你好”,执行的命令是“echo”。由于集合中只有1个元素,因此循环只运行一次。 如果改成for %%i in (你好朋友) do echo %%i 将会显示2行文字,第一行为“你好”,第二行为“朋友”。因为2个词之间有空格,因此集合中就有了2个元素,循环将运行2次。 2、注意:以上for语句的运行方式是新建一个批处理文件,即扩展名为“.bat”的文件,内容为上面的命令,然后运行。为了批处理执行完不退出,可在最后加上一条pause>null命令,这样能看到执行的结果。要想通过cmd命令行执行的话,必须将%%换成%,即去掉一个%,如下: for %i in (你好) do echo %i 3、以下所有例子都是这样,若要在命令行提示符下执行,请将所有的%%改成一个%。 三、for语句详细说明: 上面语句格式中有的加了中括号[],表示这个语句元素不是必须的,只在需要时使用。像刚才显示“你好”的命令中就没有使用[参数]这

个语句元素。所有语句元素间用空格隔开。 各语句元素的写法:for、in、do这3个符号是固定不变的 1、[参数]的种类:只有4种,分别是/d、/r、/l、/f(即目录Directory、递归recursion、序列list、文件file),他们用于对后面的集合的含义做出解释,请与下面的集合解释结合来看。这4个参数不区分大小写,可以联合使用,即一条for语句可以出现多个参数。 2、变量:除10个数字外(0-9)的所有符号(因为0-9往往作为形参使用,为了与此区别),变量名一般用单个字母表示即可,而且变量名区分大小写,即A和a是两个不同的变量。变量名前面必须是%,当在命令提示符下执行时,只用一个%;而在批处理程序中,必须用%%。 一行语句中,一般只需定义一个变量。使用/f参数中的tokens 选项可以将集合中的元素分解成多个值,并自动定义新的变量对应这些值。这时语句中可以使用多个变量,通常按字母顺序命名,即第一个是%%a,那么后一个就用%%b。如果第一个是%%i,后一个就用%%j。依此类推。具体看后面的相关内容。 变量可以直接在do后面的命令中使用。每次使用的变量总数不超过52个。 3、集合:集合必须放在括号里。集合是一行文本,这行文本可能有几种类型,如“你好”只是一串字符;“c:\boot.ini”是一个文件;“dir /b”是一个命令。 (1)如果for语句中没有使用任何参数,对待集合文本的处理方式是:

批处理命令for语句基本用法

批处理命令for语句的基本用法 [系列教程]批处理for语句从入门到精通[20101225更新] ____________________________版主提醒 ____________________________ 文档来自于网络搜索 为了避免影响技术讨论、提高看帖的舒适性,请大家不要在此帖下跟 无实质内容的口水帖,特别是纯顶、纯支持、纯感谢、路过之类的帖子, 管理人员将不定期清理此类回帖,请大家多参与讨论少灌水,与人方便, 终将给自己带来方便,谢谢合作。 ________________________________________________________________ 文档来自于网络搜索 批处理是一门简单的脚本语言,虽然不能独当一面,但是,若作为工作中的辅助工具,绝对会让大家有随用随写、称心如意的畅快感。 文档来自于网络搜索 和其他语言相比,批处理语言有其先天性的优势: 1、系统自带,无需另行安装; 2、命令少,语句简洁,上手非常快; 3、编写出来的脚本小巧玲珑,随写随用; 但是,因为它以命令行方式工作,操作多有不便,在图形界面大行其道的windows世界里,多多少少会让大众望而却步;就算是对命令行有好感的新手,面对微软有如天书的帮助文件,很多人也会败下阵来,因此,论坛里很多会员也发出了编写系统的批处理教程的呼声。

文档来自于网络搜索 编写系统的批处理新手教程,一直是论坛管理层讨论的热点问题,但是,各位管理人员大多都有工作在身,而系统的教程涉及的面是如此之广,面对如此浩大的工程,仅凭一两个人的力量,是难以做好的,因此,本人退而求其次,此次发布的教程,以专题的形式编写,日后人手渐多之后,再考虑组织人力编写全面的教程。 文档来自于网络搜索之所以选择最难的for,一是觉得for最为强大,是大多数人最希望掌握的;二是若写其他命令教程,如果没有for的基础,展开来讲解会无从下手;三是for也是批处理中最复杂最难掌握的语句,把它攻克了,批处理的学习将会一片坦途。 文档来自于网络搜索 这次的for语句系列教程,打算按照for语句的5种句式逐一展开,在讲解for/f的时候,会穿插讲解批处理中一个最为关键、也是新手最容易犯错的概念:变量延迟,大纲如下: 文档来自于网络搜索一前言 二for语句的基本用法 三for /f(含变量延迟) 四for /r 五for /d 六for /l 遵照yibantiaokuan的建议,在顶楼放出此教程的txt版本、word版本和pdf版本,以方便那些离线浏览的会员。 文档来自于网络搜索[本帖最后由namejm于2010-12-26 02:36编辑]

Excel中如何计算日期差

Excel中如何计算日期差: ----Excel中最便利的工作表函数之一——Datedif名不见经传,但却十分好用。Datedif能返回任意两个日期之间相差的时间,并能以年、月或天数的形式表示。您可以用它来计算发货单到期的时间,还可以用它来进行2000年的倒计时。 ----Excel中的Datedif函数带有3个参数,其格式如下: ----=Datedif(start_date,end_date,units) ----start_date和end_date参数可以是日期或者是代表日期的变量,而units则是1到2个字符长度的字符串,用以说明返回日期差的形式(见表1)。图1是使用Datedif函数的一个例子,第2行的值就表明这两个日期之间相差1年又14天。units的参数类型对应的Datedif返回值 “y”日期之差的年数(非四舍五入) “m”日期之差的月数(非四舍五入) “d”日期之差的天数(非四舍五入) “md”两个日期相减后,其差不足一个月的部分的天数 “ym”两个日期相减后,其差不足一年的部分的月数 “yd”两个日期相减后,其差不足一年的部分的天数

表1units参数的类型及其含义 图1可以通过键入3个带有不同参数的Datedif公式来计算日期的差。units的参数类型 ----图中:单元格Ex为公式“=Datedif(Cx,Dx,“y”)”得到的结果(x=2,3,4......下同) ----Fx为公式“=Datedif(Cx,Dx,“ym”)”得到的结果 ----Gx为公式“=Datedif(Cx,Dx,“md”)”得到的结果 现在要求两个日期之间相差多少分钟,units参数是什么呢? 晕,分钟你不能用天数乘小时再乘分钟吗? units的参数类型对应的Datedif返回值 “y”日期之差的年数(非四舍五入) “m”日期之差的月数(非四舍五入) “d”日期之差的天数(非四舍五入) “md”两个日期相减后,其差不足一个月的部分的天数 “ym”两个日期相减后,其差不足一年的部分的月数 “yd”两个日期相减后,其差不足一年的部分的天数 假设你的数据从A2和B2开始,在C2里输入下面公式,然后拖拉复制。 =IF(TEXT(A2,"h:mm:ss")

表情符号,~~~非常有用网络常用表情符号大集合哦~~~

全形顏文字 得意<( ̄︶ ̄)> 乾杯[]~( ̄▽ ̄)~*滿足( ̄ˇ ̄) 沒睡醒( ̄﹏ ̄) 狡猾(‵﹏′) 被打一巴掌( ̄ε(# ̄)無言( ̄. ̄) 無奈╮( ̄▽ ̄)╭ 裝傻( ̄▽ ̄)~* 驚訝(⊙?⊙) 發現( ̄. ̄)+ 驚嚇Σ( ° ?°|||)︴冷( ̄▽ ̄)" 沒辦法╮(╯▽╰)╭貓咪臉(= ̄ω ̄=) 疑惑( ̄3 ̄)a 阿達( ̄0  ̄)y 重創(。_。) 不(>﹏<) 懷疑(→_→) 睏( ̄o ̄) . z Z 崇拜m( __ )m 我想想(ˇ?ˇ)

生氣<( ̄﹌ ̄)> 就是你<( ̄﹌ ̄)@m Orz 挫折系列顏文字 這是經典... 大頭Orz 小頭orz 翹XXXXX Or2 放大版○| ̄|_ 雙手撐地ORZ 有表情囧rz 變化形OTL 換邊STO 換邊(小) _no 動物顏文字豬頭( ˉ(∞)ˉ ) 蝸牛"\@ 章魚(:?)≡ 蟑螂((( ●< 毛毛蟲(??)nnn 蝌蚪(: )~ 顏文字組合 使用時可加( ) 例:˙﹏˙ →(˙﹏˙) ˙?˙˙0˙˙︿˙˙ε˙˙ 3˙˙ω˙˙﹏˙˙?˙˙▽˙小眼睛

⊙?⊙⊙0⊙⊙︿⊙ ̄ε ̄ ̄3 ̄⊙ω⊙⊙﹏⊙⊙?⊙⊙▽⊙大眼睛  ̄? ̄ ̄0 ̄ ̄︿ ̄ ̄ε ̄ ̄3 ̄ ̄ω ̄ ̄﹏ ̄ ̄? ̄ ̄▽ ̄瞇瞇眼 ∩?∩∩0∩∩︿∩∩ε∩∩3∩∩ω∩∩﹏∩∩?∩∩▽∩微笑眼 ∪?∪∪0∪∪︿∪∪ε∪∪3∪∪ω∪∪﹏∪∪?∪∪▽∪悲傷眼 ˋ?ˊˋ0ˊˋ︿ˊˋεˊˋ3ˊˋωˊˋ﹏ˊˋ?ˊˋ▽ˊ生氣眼 >?<>0<>︿<>ε<>3<>ω<>﹏<>?<>▽<緊閉眼ˇ?ˇˇ0ˇˇ︿ˇˇεˇˇ 3ˇˇωˇˇ﹏ˇˇ?ˇˇ▽ˇ不爽眼 ╯?╰╯0╰╯︿╰╯ε╰╯3╰╯ω╰╯﹏╰╯?╰╯▽╰無奈眼 ≧?≦≧0≦≧︿≦≧ε≦≧3≦≧ω≦≧﹏≦≧?≦≧▽≦嬉皮眼 ????0??︿??ε??3??ω??﹏??△??▽?鬥雞眼 ????0??︿??ε??3??ω??﹏??△??▽?金魚眼 ●?●●0●●︿●●ε●● 3●●ω●●﹏●●?●●▽●外星人 +?++0++︿++ε++3++ω++﹏++?++▽+小丑眼 日系顏文字精選 (????)(??`ω′?)(?(?)?)(σ`?д?)σ(o?ω?o) 小眼睛 (???)(???*)(p?_q)(〃?o?〃)(*^?_?) (。???。) (*?0?)(?ε?●)(??ω?)(。?д?。)(???)(/??、)(?□?、*)(?-?。) (?▽?。)(?_?。) (?O?。)(ノ??。)(@???)(*??*)人(?ε?;) (?o ?)(?ェ?o)(′???『) 瞇瞇眼 (*  ̄ー ̄)( ̄ー ̄〃)(@ ̄ー ̄@)(*  ̄︿ ̄)(* ̄? ̄*)<(??*)> ( ̄(●●) ̄)( ̄?? ̄)(ー?ー)( ̄o ̄)( ̄、 ̄)(* ̄? ̄*)( ̄へ ̄)( ̄□ ̄) ( ̄~ ̄;)(。-?-。)( ̄ε ̄;)( ̄┬ ̄;)( ̄? ̄)(ノへ ̄、)(* ̄ro ̄)(ー人ー)(* ̄m ̄) 日系小眼睛 (′▽`〃)(′o`)(′ェ`)(′ε` )(=′ー`) ( ′θ`)(′○` )( ′-`)(′?`=)(*′▽`) (*′ノ0`)( ′ロ` )(′~`;)(′︿`)(*′?`*) (′m`)(′0ノ`*)(@。ε。@) (=′?`=)(●′ω`●) (′~`●)(′へ`、)(〃′o`)(;′⌒`) 日系大眼睛 (ΘΘ)(Θ~Θ〃)(ΘoΘ)(ΘェΘ)(Θ?Θ#)(ΘдΘ;)(Θ皿Θメ)(ΘーΘ*)(Θ0Θ●)(Θ▽Θ)(ΘεΘ?)(Θ?Θ。)(ΘへΘ)(Θ?Θ=)(Θ、Θ)(Θ?Θ@)(Θ3Θ) 圓珠眼 (°ー°〃)(#°Д°) (。□。) (*。?。) (*。?^*)(* ^ー。) (@。ー。@)(。?^?)(o。?。) (。▽。) (#。ε。#) (。?^d)(。?。;)(。皿。メ)(* 。3^) (〃。o。〃) ( °?°)(。?。) (°□°;) (ロ)。。(。Д。;)(*。ノO。)(;。。) 緊閉眼 (><)(;><)(>_<)(>.<)(>o<)(>▽<)(>O<)(o>▽<)(>?< ) (>▽<)(;>?<)( >з<)(o>ェ<)(>д<)(>皿<)(>_<、)(/_<。)(>。;)(>。ヘ)(ノ_<)(>。?)(>y<;)

实用批处理(bat)教程

目录 第一章批处理基础 第一节常用批处理内部命令简介 1、REM 和:: 2、ECHO 和@ 3、PAUSE 4、ERRORLEVEL 5、TITLE 6、COLOR 7、mode 配置系统设备 8、GOTO 和: 9、FIND 10、START 11、assoc 和ftype 12、pushd 和popd 13、CALL 14、shift 15、IF 16、setlocal 与变量延迟(ENABLEDELAYEDEXPANSION / DISABLEDELAYEDEXPANSION 启动或停用延缓环境变量扩展名。) 17、ATTRIB显示或更改文件属性 第二节常用特殊符号 1、@命令行回显屏蔽符 2、%批处理变量引导符 3、> 重定向符 4、>>重定向符 5、<、>、<& 重定向符 6、|命令管道符 7、^转义字符 8、组合命令 9、& 组合命令 10、||组合命令 11、\"\"字符串界定符 12、, 逗号 13、; 分号 14、() 括号 15、! 感叹号 第二章FOR命令详解 一、基本格式 二、参数/d仅为目录 三、参数/R递归(文件名) 四、参数/L迭代数值范围 五、参数/F迭代及文件解析 第三章FOR命令中的变量

一、~I- 删除任何引号(\"),扩展%I 二、%~fI- 将%I 扩展到一个完全合格的路径名 三、%~dI- 仅将%I 扩展到一个驱动器号 四、%~pI- 仅将%I 扩展到一个路径 五、%~nI- 仅将%I 扩展到一个文件名 六、%~xI- 仅将%I 扩展到一个文件扩展名 七、%~sI- 扩展的路径只含有短名 八、%~aI- 将%I 扩展到文件的文件属性 九、%~tI- 将%I 扩展到文件的日期/时间 十、%~zI- 将%I 扩展到文件的大小 十一、%~$PATH:I 第四章批处理中的变量 一、系统变量 二、自定义变量 第五章set命令详解 一、用set命令设置自定义变量 二、用set命令进行简单计算 三、用set命令进行字符串处理 1、字符串替换 2、字符串截取 第六章if命令讲解 第一种用法:IF [NOT] ERRORLEVEL number command 第二种用法:IF [NOT] string1==string2 command 第三种用法:IF [NOT] EXIST filename command 第四种用法:IF增强的用法 第七章DOS编程高级技巧 一、界面设计 二、if…else…条件语句 三、循环语句 四、子程序 五、用ftp命令实现自动下载 六、用7-ZIP实现命令行压缩和解压功能 七、调用VBScript程序 八、将批处理转化为可执行文件 九、时间延迟 1、利用ping命令延时 2、利用for命令延时 3、利用vbs延迟函数,精确度毫秒,误差1000毫秒内 4、仅用批处理命令实现任意时间延迟,精确度10毫秒,误差50毫秒内 十、模拟进度条 十一、特殊字符的输入及应用 十二、随机数(%random%)的应用技巧 十三、变量嵌套与命令嵌套 1、更正了所有的错别字,适当排版,增加条理性。

excel中计算日期差工龄生日等方法

excel中计算日期差工龄生日等方法 方法1:在A1单元格输入前面的日期,比如“2004-10-10”,在A2单元格输入后面的日期,如“2005-6-7”。接着单击A3单元格,输入公式“=DATEDIF(A1,A2,"d")”。然后按下回车键,那么立刻就会得到两者的天数差“240”。 提示:公式中的A1和A2分别代表前后两个日期,顺序是不可以颠倒的。此外,DATEDIF 函数是Excel中一个隐藏函数,在函数向导中看不到它,但这并不影响我们的使用。 方法2:任意选择一个单元格,输入公式“="2004-10-10"-"2005-6-7"”,然后按下回车键,我们可以立即计算出结果。 计算工作时间——工龄—— 假如日期数据在D2单元格。 =DA TEDIF(D2,TODAY(),"y")+1 注意:工龄两头算,所以加“1”。 如果精确到“天”—— =DA TEDIF(D2,TODAY(),"y")&"年"&DATEDIF(D2,TODAY(),"ym")&"月"&DATEDIF(D2,TODAY(),"md")&"日" 二、计算2003-7-617:05到2006-7-713:50分之间相差了多少天、多少个小时多少分钟 假定原数据分别在A1和B1单元格,将计算结果分别放在C1、D1和E1单元格。 C1单元格公式如下: =ROUND(B1-A1,0) D1单元格公式如下: =(B1-A1)*24 E1单元格公式如下: =(B1-A1)*24*60 注意:A1和B1单元格格式要设为日期,C1、D1和E1单元格格式要设为常规. 三、计算生日,假设b2为生日

=datedif(B2,today(),"y") DA TEDIF函数,除Excel2000中在帮助文档有描述外,其他版本的Excel在帮助文档中都没有说明,并且在所有版本的函数向导中也都找不到此函数。但该函数在电子表格中确实存在,并且用来计算两个日期之间的天数、月数或年数很方便。微软称,提供此函数是为了与Lotus1-2-3兼容。 该函数的用法为“DA TEDIF(Start_date,End_date,Unit)”,其中Start_date为一个日期,它代表时间段内的第一个日期或起始日期。End_date为一个日期,它代表时间段内的最后一个日期或结束日期。Unit为所需信息的返回类型。 “Y”为时间段中的整年数,“M”为时间段中的整月数,“D”时间段中的天数。“MD”为Start_date与End_date日期中天数的差,可忽略日期中的月和年。“YM”为Start_date与End_date日期中月数的差,可忽略日期中的日和年。“YD”为Start_date与End_date日期中天数的差,可忽略日期中的年。比如,B2单元格中存放的是出生日期(输入年月日时,用斜线或短横线隔开),在C2单元格中输入“=datedif(B2,today(),"y")”(C2单元格的格式为常规),按回车键后,C2单元格中的数值就是计算后的年龄。此函数在计算时,只有在两日期相差满12个月,才算为一年,假如生日是2004年2月27日,今天是2005年2月28日,用此函数计算的年龄则为0岁,这样算出的年龄其实是最公平的。 本篇文章来源于:实例教程网(https://www.doczj.com/doc/6b15082894.html,) 原文链接:https://www.doczj.com/doc/6b15082894.html,/bgruanjian/excel/631.html

批处理命令格式

批处理命令格式.txt人永远不知道谁哪次不经意的跟你说了再见之后就真的再也不见了。一分钟有多长?这要看你是蹲在厕所里面,还是等在厕所外面……echo 表示显示此命令后的字符 echo off 表示在此语句后所有运行的命令都不显示命令行本身 @与echo off相象,但它是加在每个命令行的最前面,表示运行时不显示这一行的命令行(只能影响当前行)。 call 调用另一个批处理文件(如果不用call而直接调用别的批处理文件,那么执行完那个批处理文件后将无法返回当前文件并执行当前文件的后续命令)。 pause 运行此句会暂停批处理的执行并在屏幕上显示Press any key to continue...的提示,等待用户按任意键后继续 rem 表示此命令后的字符为解释行(注释),不执行,只是给自己今后参考用的(相当于程序中的注释)。 例1:用edit编辑a.bat文件,输入下列内容后存盘为c: a.bat,执行该批处理文件后可实现:将根目录中所有文件写入 a.txt中,启动UCDOS,进入WPS等功能。 批处理文件的内容为: 命令注释: @echo off 不显示后续命令行及当前命令行 dir c: *.* >a.txt 将c盘文件列表写入a.txt call c: ucdos ucdos.bat 调用ucdos echo 你好显示"你好" pause 暂停,等待按键继续 rem 准备运行wps 注释:准备运行wps cd ucdos 进入ucdos目录 wps 运行wps 批处理文件的参数 批处理文件还可以像C语言的函数一样使用参数(相当于DOS命令的命令行参数),这需要用到一个参数表示符“%”。 %[1-9]表示参数,参数是指在运行批处理文件时在文件名后加的以空格(或者Tab)分隔的字符串。变量可以从%0到%9,%0表示批处理命令本身,其它参数字符串用%1到%9顺序表示。例2:C:根目录下有一批处理文件名为f.bat,内容为: @echo off format %1 如果执行C: >f a: 那么在执行f.bat时,%1就表示a:,这样format %1就相当于format a:,于是上面的命令运行时实际执行的是format a: 例3:C:根目录下一批处理文件名为t.bat,内容为: @echo off type %1 type %2 那么运行C: >t a.txt b.txt %1 : 表示a.txt %2 : 表示b.txt 于是上面的命令将顺序地显示a.txt和b.txt文件的内容。 特殊命令 if goto choice for是批处理文件中比较高级的命令,如果这几个你用得很熟练,你就是批

批处理基础知识

批处理文件基础知识 一、单符号message指定让MS-DOS在屏幕上显示的正文 ~ ①在for中表示使用增强的变量扩展。 ②在%var:~n,m%中表示使用扩展环境变量指定位置的字符串。 ③在set/a中表示一元运算符,将操作数按位取反。 ! ①在set /a中一元运算符,表示逻辑非。比如set /a a=!0,这时a就表示逻辑1。 @ ①隐藏命令行本身的回显,常用于批处理中。 % ①在set /a中的二元运算符,表示算术取余。 ②命令行环境下,在for命令in前,后面接一个字符(可以是字母、数字或者一些特定字符),表示指定一个循环或者遍历指标变量。 ③批处理中,后接一个数字表示引用本批处理当前执行时的指定的参数。 ④其它情况下,%将会被脱去(批处理)或保留(命令行) ^ ①取消特定字符的转义作用,比如& | > < ! "等,但不包括%。比如要在屏幕显示一些特殊的字符,比如> >> | ^ &等符号时,就可以在其前面加一个^符号来显示这个^后面的字符了,^^就是显示一个^,^|就是显示一个|字符了; ②在set/a中的二元运算符,表示按位异或。 ③在findstr/r的[]中表示不匹配指定的字符集。 & ①命令连接字符。比如我要在一行文本上同时执行两个命令,就可以用&命令连接这两个命令。 ②在set/a中是按位与。 : ①标签定位符,表示其后的字符串为以标签,可以作为goto命令的作用对象。比如在批处理文件里面定义了一个":begin"标签,用"goto begin"命令就可以转到":begin"标签后面来执行批处理命令了。 ②在%var:string1=string2%中分隔变量名和被替换字串关系。 | ①管道符,就是将上一个命令的输出,作为下一个命令的输入."dir /a/b |more"就可以逐屏的显示dir命令所输出的信息。 ②在set/a中的二元运算符,表示按位或。 ③在帮助文档中表示其前后两个开关、选项或参数是二选一的。 / ①表示其后的字符(串)是命令的功能开关(选项)。比如"dir /s/b/a-d"表示"dir"命令指定的不同的参数。 ②在set/a中表示除法。 > ①命令重定向符,将其前面的命令的输出结果重新定向到其后面的设备中去,后面的设备中的内容被覆盖。比如可以用"dir > lxmxn.txt"将"dir"命令的结果输出到"lxmxn.txt"这个文本文件中去。 ②在findstr/r中表示匹配单词的右边界,需要配合转义字符\使用。 < ①将其后面的文件的内容作为其前面命令的输入。 ②在findstr/r中表示匹配单词的左边界,需要配合转义字符\使用。 . ①在路径的\后紧跟或者单独出现时:

特殊符号大全(表情符号)

囧???⊕?Θ?¤㈱㊣??????▕??▓?▔⊿??▂▃▄▅▆▇██■?回□』∵╝╚╔╗╬═╓╩┠┨┯┷┏┓┗┛┳?》「┌┐└┘∟〉《′?″?↘↙??┇┅﹉﹊﹍﹎╭╮╰╯*^_^* ^*^ ^-^ ^_^ ^(^ ∮?‖||︴﹏﹋﹌()【】」『〒〓@:!/\ " _ < > `,?。?{}~ ~() _ -》「?$ @ * & # ?卐??Χ∪∩‵?の℡〔§?"?ミ灬μ??~μδω* ㄚ??+-??+-a/=∫???∧∨??‖※??∶∷?<>じ?veve′?????■?》「Χ?″??㊣?~〒〓@μδω□?』??ぷ?卐」『??∩¤????∽ㄚ∵↘↙┗┛╰?╮∽??????????≈???≌?????≒????????丨丩丬丶丷丿乀乙乂乄乆乛亅亠亻冂冫冖凵刂讠辶釒钅阝飠牜饣卩卪厸厶厽孓宀川巜彳廴三彐彳忄扌攵氵灬爫犭病癶礻糹纟罒冈耂艹虍言西 兦亼亽亖亗盲凸凹卝卍卐匸皕旡玊尐开木囘囙囚四囜囝回囟因女团団囤亢囦囧囨云囱囫囬园化囯困囱囲図围抡囶囷正囹固囻囼国图囿圀圁圂圃吾圅圆囵圈幸青国圌围园圏圐圑员圆圔圕图圗团圙圚圛圈圝圞 一般常用特殊符号 ,、。.?!~$%@&#*? ;?…¨,??? ‘’“”"?`?〃′??″↖↗↙↘㊣???⊕?????????□■▔▓§?〒????? 贴图符号大全 A、希腊字母大写ΑΒΓΓΔΕΖΘΗΚ∧ΜΝΞΟ?Ρ?ΤΥΦΦΧΨ B、希腊字母小写αβγδεδεζηθικλμνπξζηυθχψω C、俄文字母大写АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ D、俄文字母小写абвгде?жзийклмнопрстуфхцчшщъыьэюя E、注音符号??ㄅㄌㄐㄔㄘ?ー??ㄆㄉㄙㄍㄑㄕ?ヽ??ㄇㄊㄚㄎㄒㄖ???ㄈㄋㄛㄏㄓㄗ F、拼音o?ǎ-、ōμǒ′、±?°?ˉ、?3ǐ2、ū?ǔ·、ǖǘǚǜ1 G、日文平假名〔ぃぅぇぉかきくけこんさしすせそたちつってとゐなにぬねのはひふへほゑまみむめもゃゅょゎを H、日文片假名?ィゥヴェォカヵキクケヶコサシスセソタチツッテトヰンナニヌネノハヒフヘホヱマミムメモャュョヮヲ

DOS批处理命令大全

写批处理 扩展名是bat(在nt/2000/xp/2003下也可以是cmd)的文件就是批处理文件。 ==== willsort 编注======================================= .bat是dos下的批处理文件 .cmd是nt内核命令行环境的另一种批处理文件 从更广义的角度来看,unix的shell脚本以及其它操作系统甚至应用程序中由外壳进行解释执行的文本,都具有与批处理文件十分相似的作用,而且同样是由专用解释器以行为单位解释执行,这种文本形式更通用的称谓是脚本语言。所以从某个程度分析,batch, unix shell, awk, basic, perl 等脚本语言都是一样的,只不过应用的范围和解释的平台各有不同而已。甚至有些应用程序仍然沿用批处理这一称呼,而其内容和扩展名与dos的批处理却又完全不同。 =================================== 首先批处理文件是一个文本文件,这个文件的每一行都是一条DOS命令(大部分时候就好象我们在DOS 提示符下执行的命令行一样),你可以使用DOS下的Edit或者Windows的记事本(notepad)等任何文本文件编辑工具创建和修改批处理文件。 ==== willsort 题注=================== 批处理文件中完全可以使用非dos命令,甚至可以使用不具有可执行特性的普通数据性文件,这缘于wind ows系统这个新型解释平台的涉入,使得批处理的应用越来越"边缘化"。所以我们讨论的批处理应该限定在dos环境或者命令行环境中,否则很多观念和设定都需要做比较大的变动。 ======================== 其次,批处理文件是一种简单的程序,可以通过条件语句(if)和流程控制语句(goto)来控制命令运行的流程,在批处理中也可以使用循环语句(for)来循环执行一条命令。当然,批处理文件的编程能力与C语言等编程语句比起来是十分有限的,也是十分不规范的。批处理的程序语句就是一条条的DOS命令(包括内部命令和外部命令),而批处理的能力主要取决于你所使用的命令。 ==== willsort 编注================== 批处理文件(batch file)也可以称之为批处理程序(batch program),这一点与编译型语言有所不同,就c语言来说,扩展名为c或者cpp的文件可以称之为c语言文件或者c语言源代码,但只有编译连接后的exe 文件才可以称之为c语言程序。因为批处理文件本身既具有文本的可读性,又具有程序的可执行性,这些称谓的界限是比较模糊的。 =========================== 第三,每个编写好的批处理文件都相当于一个DOS的外部命令,你可以把它所在的目录放到你的DOS搜索路径(path)中来使得它可以在任意位置运行。一个良好的习惯是在硬盘上建立一个bat或者batch目录(例如C:\BATCH),然后将所有你编写的批处理文件放到该目录中,这样只要在path中设置上c:\batch,你就可以在任意位置运行所有你编写的批处理程序。 ==== willsort 编注===== 纯以dos系统而言,可执行程序大约可以细分为五类,依照执行优先级由高到低排列分别是:DOSKEY宏命令(预先驻留内存),https://www.doczj.com/doc/6b15082894.html,中的内部命令(根据内存的环境随时进驻内存),以com为扩

各种表情符号大全。。。

≡(▔﹏▔)≡⊙﹏⊙∥∣°ˋ︿ˊ﹀-# ╯︿╰﹀ (=‵′=) <(‵^′)> (-__-)b  ̄□ ̄||-----\\(˙<>˙)/----- <("""O"""> (O ^ ~ ^ O) (*^︹^*︺( /。\ ) ( ' – ' ) ( ^3^ )╱~~ (;°○° ) ( > c < ) <( ̄︶ ̄)> <( ̄︶ ̄)/ b( ̄▽ ̄)d 汗( ̄口 ̄)!! ╮( ̄▽ ̄)╭╰( ̄▽ ̄)╭╮( ̄﹏ ̄)╭ ( ̄▽ ̄@) ○( ̄﹏ ̄)○ <( ̄oo, ̄)/ ╮( ̄▽ ̄"╭︿( ̄︶ ̄)︿ 凶手!凶手就是你! <( ̄﹌ ̄)@m 我..我..是大猪头╭(﹊∩∩﹊#)╮来嘛!╮(╯◇╰)╭口禾火~口禾火~…(⊙_⊙;)…○圭~○列~怎么酱? <( ̄oo, ̄)/猪头不是一天造成的! ˋ(′o‵")ˊ这个你问我也不知道~ 有火星人~ \("▔□▔)/\("▔□▔)/ 不要以为我不知道咩!┌(‵▽′)╭<( ̄ c ̄)y▂ξ真烦,来哈根草吧~ 叔叔~这样很冷耶! (#-.-)/ 我是优质大帅哥一枚. \( ̄▽ ̄)♂♀( ̄▽ ̄)/ 我是优质大美女一枚. ┐(─__─)┌你说我有啥米办法咧~ 吃饱饱,睡好好! ○(* ̄︶ ̄*)○有没有被猪揍过啊? ○(#‵︿′#)○ε(┬┬_┬┬)3 我真命苦 .. 拆屋┴┴︵╰(‵□′)╯︵┴┴≡ ̄﹏ ̄≡冷到不行.. <(‵^′)> 我看你还是回火星去好了! <( ̄oo, ̄)/ 没看过猪哥吗??... <( ̄︶ ̄)/ 喜欢吗?把拔买给你~︿( ̄︶ ̄)︿这学期欧趴欧趴啦~无影脚升级版 <(  ̄^ ̄)︵θ︵θ︵θ︵θ︵θ︵θ︵θ︵θ︵θ☆( >_<)~啊! 恶魔集团o(‵▽′)ψ( ̄︶ ̄)ψ( ̄︶ ̄)ψψ(╰_╯)σ☆咒 嘟着嘴 ( ̄)︿( ̄) \(~__~)/ 要抱抱啦... 满意.满足 <( ̄︶ ̄)> []~( ̄▽ ̄)~* ( ̄﹏ ̄) ( ̄ˇ ̄) \( ̄︶ ̄)> <( ̄︶ ̄)/ (‵﹏′) ╮(‵▽′)╭\(‵▽′)/ =============================================

目前为止最全的批处理教程

目录 第一章 批处理基础 第一节 常用批处理内部命令简介 1、REM 和 :: 2、ECHO 和 @ 3、PAUSE 4、ERRORLEVEL 5、TITLE 6、COLOR 7、mode 配置系统设备 8、GOTO 和 : 9、FIND 10、START 11、assoc 和 ftype 12、pushd 和 popd 13、CALL 14、shift 15、IF 16、setlocal 与 变量延迟(ENABLEDELAYEDEXPANSION / DISABLEDELAYEDEXPANSION 启动或停用延缓环境变量扩展名。) 17、ATTRIB显示或更改文件属性 第二节 常用特殊符号

1、@命令行回显屏蔽符 2、%批处理变量引导符 3、> 重定向符 4、>>重定向符 5、<、>、<& 重定向符 6、|命令管道符 7、^转义字符 8、组合命令 9、& 组合命令 10、||组合命令 11、\"\"字符串界定符 12、, 逗号 13、; 分号 14、() 括号 15、! 感叹号 第二章 FOR命令详解 一、基本格式 二、参数 /d仅为目录 三、参数 /R递归(文件名) 四、参数 /L迭代数值范围 五、参数 /F迭代及文件解析 第三章 FOR命令中的变量

一、 ~I- 删除任何引号(\"),扩展 %I 二、 %~fI- 将 %I 扩展到一个完全合格的路径名 三、 %~dI- 仅将 %I 扩展到一个驱动器号 四、 %~pI- 仅将 %I 扩展到一个路径 五、 %~nI- 仅将 %I 扩展到一个文件名 六、 %~xI- 仅将 %I 扩展到一个文件扩展名 七、 %~sI- 扩展的路径只含有短名 八、 %~aI- 将 %I 扩展到文件的文件属性 九、 %~tI- 将 %I 扩展到文件的日期/时间 十、 %~zI- 将 %I 扩展到文件的大小 十一、 %~$PATH:I 第四章 批处理中的变量 一、系统变量 二、自定义变量 第五章 set命令详解 一、用set命令设置自定义变量 二、用set命令进行简单计算 三、用set命令进行字符串处理 1、字符串替换 2、字符串截取 第六章 if命令讲解 第一种用法:IF [NOT] ERRORLEVEL number command

windows批处理命令详解及脚本实例

批处理文件是将一系列命令按一定的顺序集合为一个可执行的文本文件,其扩展名为BAT。第一部分:批处理内部命令 1、REM REM 是个注释命令一般是用来给程序加上注解的,该命令后的内容在程序执行的时候将不会被显示和执行。例: REM 你现在看到的就是注解,这一句将不会被执行。在以后的例子中解释的内容都REM 会放在REM后面。请大家注意。 2、ECHO ECHO 是一个回显命令主要参数有OFF和ON,一般用ECHO message来显示一个特定的消息。例: Echo off Rem 以上代表关闭回显即不显示所执行的命令 Echo 这个就是消息。 Rem 以上代表显示"这就是消息"这列字符 执行结果: C:\>ECHO.BAT 这个就是消息。 3、GOTO GOTO 即为跳转的意思。在批处理中允许以":XXX"来构建一个标号然后用GOTO :标号直接来执行标号后的命令。例 :LABEL REM 上面就是名为LABEL的标号。 DIR C:\ DIR D:\ GOTO LABEL REM 以上程序跳转标号LABEL处继续执行。 4、CALL CALL 命令可以在批处理执行过程中调用另一个批处理,当另一个批处理执行完后再继续

执行原来的批处理。例: 批处理2.BAT内容如下: ECHO 这就是2的内容 批处理1.BAT内容如下: ECHO 这是1的内容 CALL 2.BAT ECHO 1和2的内容全部显示完成 执行结果如下: C:\>1.BAT 这是1的内容 这就是2的内容 1和2的内容全部显示完成 5、PAUSE PAUSE 停止系统命令的执行并显示下面的内容。例: C:\> PAUSE 请按任意键继续. . . 6、IF IF 条件判断语句,语法格式如下: IF [NOT] ERRORLEVEL number command IF [NOT] string1==string2 command IF [NOT] EXIST filename command 说明: [NOT] 将返回的结果取反值即"如果没有"的意思。 ERRORLEVEL 是命令执行完成后返回的退出值 Number 退出值的数字取值范围0~255。判断时值的排列顺序应该又大到小。返回的值大于或等于指定的值时条件成立。 string1==string2 string1和string2都为字符的数据,英文字符的大小写将看做不同,这个条件中的等于号必须是2个(绝对相等),条件想等后即执行后面的command EXIST filename 为文件或目录存在的意思。 IF ERRORLEVEL这条语句必须放在某一个命令后面。执行命令后由IF ERRORLEVEL来

相关主题
文本预览
相关文档 最新文档