当前位置:网站首页>Mean Value Coordinates
Mean Value Coordinates
2022-06-13 02:18:00 【Researcher-Du】
Mean coordinates –Mean Value Coordinates(MVC) Is an important interpolation technique , It is widely used in parameterization 、 Mesh deformation and other geometric processing directions . But few blogs tell about MVC, Especially for computing triangular meshes MVC, Most people implement it directly according to the pseudo code in the paper . Recently I reread about MVC A few classic papers of , So here is a brief introduction .
1. The coordinates of the center of gravity
For triangles △ v 1 v 2 v 3 \triangle v_1v_2v_3 △v1v2v3 At any point p p p Expressed as a convex combination of three vertices of a triangle , That is, the following equation is satisfied :
p = λ 1 v 1 + λ 2 v 2 + λ 3 v 3 p = \lambda_1v_1 + \lambda_2v_2 + \lambda_3v_3 p=λ1v1+λ2v2+λ3v3 (1)
λ 1 + λ 2 + λ 3 = 1 \lambda_1 + \lambda_2 + \lambda_3 = 1 λ1+λ2+λ3=1 (2)
For triangles , As shown in the figure below , Weights are easy to calculate ( The ratio of triangle area ):
λ 1 = A △ p v 2 v 3 / A △ v 1 v 2 v 3 \lambda_1 = A\triangle pv_2v_3 / A\triangle v_1v_2v_3 λ1=A△pv2v3/A△v1v2v3,
λ 2 = A △ p v 1 v 3 / A △ v 1 v 2 v 3 \lambda_2 =A\triangle pv_1v_3 / A\triangle v_1v_2v_3 λ2=A△pv1v3/A△v1v2v3,
λ 3 = A △ p v 1 v 2 / A △ v 1 v 2 v 3 \lambda_3 = A\triangle pv_1v_2 / A\triangle v_1v_2v_3 λ3=A△pv1v2/A△v1v2v3
Why is it called barycentric coordinates ? The following is an excerpt from : The coordinates of the center of gravity (Barycentric coordinates)
equation (1) Can be converted to :
λ 1 ( v 1 − p ) + λ 2 ( v 2 − p ) + λ 3 ( v 3 − p ) = 0 \lambda_1(v_1-p) +\lambda_2(v_2-p) +\lambda_3(v_3-p) = 0 λ1(v1−p)+λ2(v2−p)+λ3(v3−p)=0
=> λ 1 p v 1 + λ 2 p v 2 + λ 3 p v 3 = 0 \lambda_1\mathbf{pv_1} + \lambda_2\mathbf{pv_2} +\lambda_3\mathbf{pv_3} = 0 λ1pv1+λ2pv2+λ3pv3=0
It is equivalent to that we are at the three vertices of the triangle v 1 v_1 v1 The hanging weight is λ 1 \lambda_1 λ1, v 2 v_2 v2 The hanging weight is λ 2 \lambda_2 λ2, v 3 v_3 v3 The hanging weight is λ 3 \lambda_3 λ3 When the weight of , If you put p p p Place it on the lightning rod , Can maintain balance , In this case p p p Center of gravity .
2. Generalized barycentric coordinates
As mentioned above , It is easy to calculate the barycentric coordinates of a triangle , But we're not satisfied with that . We want to solve the interior vertex of a polygon Generalized barycentric coordinates , That is, the vertices inside the polygon are represented as convex combinations of polygon vertices :
p = ∑ i = 1 n λ i v i p = \sum^{n}_{i=1}\lambda_iv_i p=∑i=1nλivi (3)
∑ i = 1 n λ i = 1 \sum^{n}_{i=1}\lambda_i = 1 ∑i=1nλi=1 (4)
There are many ways to find generalized barycentric coordinates, such as : Mean coordinates (MVC), Green coordinates (GC), Harmonic coordinates (HC) etc. , Here we introduce the widely used calculation method of mean value .
3. 2D Mean coordinates
For general 2D The polygon of ,Floater The mean coordinate given is :
λ i = w i / ∑ j = 1 n w j \lambda_i = w_i / \sum^{n}_{j=1}w_j λi=wi/∑j=1nwj,
w i = [ t a n ( α i − 1 / 2 ) + t a n ( α i / 2 ) ] / ∣ ∣ v i − p ∣ ∣ w_i = [tan(\alpha_{i-1}/2)+tan(\alpha_i/2)] / ||v_i-p|| wi=[tan(αi−1/2)+tan(αi/2)]/∣∣vi−p∣∣ (5)
It can be seen that the coordinates represented by this form are always positive , Now I'll simply move this proof process ,
Our goal is to convert the points inside the polygon p p p Represented as a convex combination of polygon vertices : p = ∑ i = 1 n λ i v i p = \sum^{n}_{i=1}\lambda_iv_i p=∑i=1nλivi
Equivalent to : ∑ i = 1 n λ i ( v i − p ) = 0 \sum^{n}_{i=1}\lambda_i(v_i-p) = 0 ∑i=1nλi(vi−p)=0, and λ i = w i / ∑ j = 1 n w j \lambda_i = w_i / \sum^{n}_{j=1}w_j λi=wi/∑j=1nwj
Multiply the left and right sides by ∑ j = 1 n w j \sum^{n}_{j=1}w_j ∑j=1nwj, Yes : ∑ i = 1 n w i ( v i − p ) = 0 \sum^{n}_{i=1}w_i(v_i-p) = 0 ∑i=1nwi(vi−p)=0 (6)
Next , Use v 0 v_0 v0 The polar coordinates at represent v i v_i vi: v i = v 0 + ∣ ∣ v i − p ∣ ∣ ( c o s θ i , s i n θ i ) v_i = v_0 + ||v_i-p||(cos\theta_i, sin\theta_i) vi=v0+∣∣vi−p∣∣(cosθi,sinθi)
So there are : ( v i − p ) / ∣ ∣ v i − p ∣ ∣ = ( c o s θ i , s i n θ i ) (v_i-p) / ||v_i-p|| = (cos\theta_i, sin\theta_i) (vi−p)/∣∣vi−p∣∣=(cosθi,sinθi) , α i = θ i + 1 − θ i \alpha_i = \theta_{i+1}-\theta_i αi=θi+1−θi (7)
take (5) Plug in (6):
∑ i = 1 n [ t a n ( α i − 1 / 2 ) + t a n ( α i / 2 ) ] ⋅ ( v i − p ) / ∣ ∣ v i − p ∣ ∣ = 0 \sum^{n}_{i=1}[tan(\alpha_{i-1}/2)+tan(\alpha_i/2)]\cdot (v_i-p) / ||v_i-p|| = 0 ∑i=1n[tan(αi−1/2)+tan(αi/2)]⋅(vi−p)/∣∣vi−p∣∣=0 (8)
take (7) Plug in (8):
∑ i = 1 n [ t a n ( α i − 1 / 2 ) + t a n ( α i / 2 ) ] ( c o s θ i , s i n θ i ) = 0 \sum^{n}_{i=1}[tan(\alpha_{i-1}/2)+tan(\alpha_i/2)](cos\theta_i, sin\theta_i) = 0 ∑i=1n[tan(αi−1/2)+tan(αi/2)](cosθi,sinθi)=0 (9)
The above formula is further equivalent to :
∑ i = 1 n t a n ( α i / 2 ) [ ( c o s θ i , s i n θ i ) + ( c o s θ i + 1 , s i n θ i + 1 ) ] = 0 \sum^{n}_{i=1}tan(\alpha_i/2)[(cos\theta_i, sin\theta_i) + (cos\theta_{i+1}, sin\theta_{i+1})] = 0 ∑i=1ntan(αi/2)[(cosθi,sinθi)+(cosθi+1,sinθi+1)]=0 (10)
If we can prove the equation (10) establish , Then the vertices inside the polygon can be represented by an equation (5) The coordinates shown represent ( interpolation ).
First , We know , The sum of all unit vectors from the center of the circle to the circumference is 0 vector , Because any vector can find a vector with the same size and opposite direction .
0 = ∫ 0 2 π ( c o s θ , s i n θ ) \mathbf{0} = \int^{2\pi}_0 (cos\theta,sin\theta) 0=∫02π(cosθ,sinθ)
= ∑ i = 1 k ∫ θ i θ i + 1 ( c o s θ , s i n θ ) = \sum^k_{i=1}\int^{\theta_{i+1}}_{\theta_i}(cos\theta,sin\theta) =∑i=1k∫θiθi+1(cosθ,sinθ)
= ∑ i = 1 k ∫ θ i θ i + 1 s i n ( θ i + 1 − θ ) s i n α i ( c o s θ i , s i n θ i ) + s i n ( θ − θ i ) s i n α i ( c o s θ i + 1 , s i n θ i + 1 ) = \sum^k_{i=1}\int^{\theta_{i+1}}_{\theta_i}\frac{sin(\theta_{i+1}-\theta)}{sin\alpha_i}(cos\theta_i,sin\theta_i) + \frac{sin(\theta-\theta_i)}{sin\alpha_i}(cos\theta_{i+1},sin\theta_{i+1}) =∑i=1k∫θiθi+1sinαisin(θi+1−θ)(cosθi,sinθi)+sinαisin(θ−θi)(cosθi+1,sinθi+1)
The third line here is cleverly constructed . Integral of the above formula :
= ∑ i = 1 k ( c o s θ i , s i n θ i ) s i n α i ∫ θ i θ i + 1 s i n ( θ i + 1 − θ ) d θ + ( c o s θ i + 1 , s i n θ i + 1 ) s i n α i ∫ θ i θ i + 1 s i n ( θ − θ i + 1 ) d θ = \sum^k_{i=1}\frac{(cos\theta_i,sin\theta_i)}{ {sin\alpha_i}}\int^{\theta_{i+1}}_{\theta_i} sin(\theta_{i+1}-\theta) d\theta + \frac{(cos\theta_{i+1},sin\theta_{i+1})}{ {sin\alpha_i}}\int^{\theta_{i+1}}_{\theta_i} sin(\theta -\theta_{i+1}) d\theta =∑i=1ksinαi(cosθi,sinθi)∫θiθi+1sin(θi+1−θ)dθ+sinαi(cosθi+1,sinθi+1)∫θiθi+1sin(θ−θi+1)dθ (11)
and ∫ θ i θ i + 1 s i n ( θ i + 1 − θ ) d θ = ∫ θ i θ i + 1 s i n ( θ − θ i + 1 ) d θ = 1 − c o s α i \int^{\theta_{i+1}}_{\theta_i} sin(\theta_{i+1}-\theta) d\theta = \int^{\theta_{i+1}}_{\theta_i} sin(\theta -\theta_{i+1}) d\theta = 1 - cos\alpha_i ∫θiθi+1sin(θi+1−θ)dθ=∫θiθi+1sin(θ−θi+1)dθ=1−cosαi, therefore (11) The calculation result is :
= ∑ i = 1 k ( 1 − c o s α i ) ( c o s θ i , s i n θ i ) s i n α i + ( 1 − c o s α i ) ( c o s θ i + 1 , s i n θ i + 1 ) s i n α i = \sum^k_{i=1}\frac{(1-cos\alpha_i)(cos\theta_i,sin\theta_i)}{ {sin\alpha_i}} + \frac{(1-cos\alpha_i)(cos\theta_{i+1},sin\theta_{i+1})}{ {sin\alpha_i}} =∑i=1ksinαi(1−cosαi)(cosθi,sinθi)+sinαi(1−cosαi)(cosθi+1,sinθi+1) (12)
because : 1 − c o s α i s i n α i = t a n ( α i / 2 ) \frac{1-cos\alpha_i}{sin\alpha_i} = tan(\alpha_i/2) sinαi1−cosαi=tan(αi/2), therefore (12) Equivalent to :
= ∑ i = 1 k t a n ( α i / 2 ) [ ( c o s θ i , s i n θ i ) + ( c o s θ i + 1 , s i n θ i + 1 ) ] = \sum^k_{i=1}tan(\alpha_i/2)[(cos\theta_i,sin\theta_i) + (cos\theta_{i+1},sin\theta_{i+1})] =∑i=1ktan(αi/2)[(cosθi,sinθi)+(cosθi+1,sinθi+1)] (13)
therefore , equation (10) Obtain evidence .
Specific reference Floater The paper of :Mean value coordinates. Computer aided geometric design, 2003
4. 3D Mean coordinates
Our goal is to transform any point inside the triangular mesh p p p Represented as a convex combination of triangular mesh vertices : Like the equation (3)(4) Shown .
If you can find this coordinate to represent p p p Words , that , We will get the formula (6): ∑ i = 1 n w i ( v i − p ) = 0 \sum^{n}_{i=1}w_i(v_i-p) = 0 ∑i=1nwi(vi−p)=0 (6)
Here we make p p p A unit ball at the center of a ball , Project the triangular mesh onto the sphere .
The triangles on each mesh will be projected onto the sphere to form spherical triangles , Such as in the figure above (2)(3) Each spherical triangle in corresponds to an average vector m m m, This vector is all from p p p Point to All points on the spherical triangle The result of the integral of the unit vector of ( Sum up ).
according to Stokes’ Theorem, The integral of the unit normal vector of all points on a closed surface is 0 The vector has :
∑ k = 1 3 1 2 θ k n k + m = 0 \sum^3_{k=1}\frac{1}{2}\theta_kn_k + m = \mathbf{0} ∑k=1321θknk+m=0 (14)
among , 1 2 θ k \frac{1}{2}\theta_k 21θk The angle is θ k \theta_k θk The area of the sector , n k n_k nk Is the normal direction of this plane , therefore 1 2 θ k n k \frac{1}{2}\theta_kn_k 21θknk The normal integral of this surface .(14) indicate , Unit normal integral of three fan-shaped sides + Sum of unit vector integrals on a spherical triangle = 0 vector .
meanwhile , We found that m m m It can also be expressed as a linear combination of three vectors :
m = ∑ k = 1 3 w k ( v k − p ) m = \sum^3_{k=1} w_k(v_k - p) m=∑k=13wk(vk−p) (15)
Obviously , Upper figure (4) Wedge in , Three straight edges are three vectors ( v k − p ) (v_k - p) (vk−p) Unit vector . And any vector m m m Of course, these three basis vectors can uniquely represent .
combination (14)(15) We can get the following equation :
m = ∑ k = 1 3 1 2 θ k n k = ∑ k = 1 3 w k ( v k − p ) m = \sum^3_{k=1}\frac{1}{2}\theta_kn_k = \sum^3_{k=1} w_k(v_k - p) m=∑k=1321θknk=∑k=13wk(vk−p) (16)
Suppose that the three vertices corresponding to the current triangle are v 1 , v 2 , v 3 v_1,v_2,v_3 v1,v2,v3, Expanded :
m = w 1 ( v 1 − p ) + w 2 ( v 2 − p ) + w 3 ( v 3 − p ) m = w_1(v_1 - p)+ w_2(v_2 - p) + w_3(v_3 - p) m=w1(v1−p)+w2(v2−p)+w3(v3−p) (17)
It should be noted that : p v 1 pv_1 pv1 And p v 2 pv_2 pv2 The normal direction of the plane is n 3 n_3 n3, p v 2 pv_2 pv2 And p v 3 pv_3 pv3 The normal direction of the plane is n 1 n_1 n1, p v 1 pv_1 pv1 And p v 3 pv_3 pv3 The normal direction of the plane is n 2 n_2 n2.
therefore , For the formula (17), To separate w 1 w_1 w1 Just multiply the left and right sides of the equation n 1 n_1 n1 that will do , This will eliminate the last two items . So there is :
w k = n k ⋅ m n k ⋅ ( v k − p ) w_k = \frac{n_k\cdot m}{n_k \cdot (v_k-p)} wk=nk⋅(vk−p)nk⋅m
Of course , This is just a triangle △ v i v j v k \triangle v_iv_jv_k △vivjvk Project onto a sphere , The calculated vertices of this triangle are relative to the inner vertices p p p The contribution of , Actually, it's just here v i v_i vi for , It may also be associated with other triangles , such as △ v i v j v q \triangle v_iv_jv_q △vivjvq, In the actual calculation process, all triangles should be traversed for calculation .
Specific reference Tao Ju The paper of :Mean value coordinates for closed triangular meshes, ACM Siggraph 2005 Papers. 2005
And corresponding slides: https://people.engr.tamu.edu/schaefer/teaching/689_Fall2006/talks/meanvalue.pdf
边栏推荐
- Chapter7-13_ Dialogue State Tracking (as Question Answering)
- C language compressed string is saved to binary file, and the compressed string is read from binary file and decompressed.
- Chapter7-11_ Deep Learning for Question Answering (2/2)
- C language complex type description
- 柏瑞凯电子冲刺科创板:拟募资3.6亿 汪斌华夫妇为大股东
- [the second day of the actual combat of the smart lock project based on stm32f401ret6 in 10 days] light up with the key ----- input and output of GPIO
- [the second day of actual combat of smart lock project based on stm32f401ret6 in 10 days] GPIO and register
- synchronized下的 i+=2 和 i++ i++执行结果居然不一样
- 华为设备配置双反射器优化虚拟专用网骨干层
- The scientific innovation board successfully held the meeting, and the IPO of Kuangshi technology ushered in the dawn
猜你喜欢

华为设备配置私网IP路由FRR
![[work notes] the problem of high leakage current in standby mode of dw7888 motor driver chip](/img/d1/c4776e3db1b7560331fa569c40831a.jpg)
[work notes] the problem of high leakage current in standby mode of dw7888 motor driver chip

传感器:SHT30温湿度传感器检测环境温湿度实验(底部附代码)

C language conditional compilation routine

Classification and summary of system registers in aarch64 architecture of armv8/arnv9

【Unity】打包WebGL项目遇到的问题及解决记录
![[51nod.3210] binary Statistics (bit operation)](/img/37/aa4a549deebf994b0049d41d49ff12.jpg)
[51nod.3210] binary Statistics (bit operation)

What did Hello travel do right for 500million users in five years?

When AI meets music, iFLYTEK music leads the industry reform with technology

I didn't expect that the index occupies several times as much space as the data MySQL queries the space occupied by each table in the database, and the space occupied by data and indexes. It is used i
随机推荐
CCF 201409-1: adjacent number pairs (100 points + problem solving ideas)
JS get element
Why is Huawei matebook x Pro 2022 leading a "laptop" revolution
ROS learning-6 detailed explanation of publisher programming syntax
[analysis notes] source code analysis of siliconlabs efr32bg22 Bluetooth mesh sensorclient
Gadgets: color based video and image cutting
Leetcode daily question - 890 Find and replace mode
Microsoft Pinyin opens U / V input mode
Parameter measurement method of brushless motor
Configuring virtual private network FRR for Huawei equipment
蓝牙模块:使用问题集锦
Understanding and thinking about multi-core consistency
Huawei equipment is configured with CE dual attribution
Stm32 mpu6050 servo pan tilt support follow
Top level configuration + cooling black technology + cool appearance, the Red Devils 6S Pro is worthy of the flagship game of the year
Huawei equipment configures private IP routing FRR
About the fact that I gave up the course of "Guyue private room course ROS manipulator development from introduction to actual combat" halfway
(novice to) detailed tutorial on machine / in-depth learning with colab from scratch
swiper 横向轮播 grid
Laptop touch pad operation