miaocb
2015-03-02 03:07:00 UTC
Hi, all
The following code repeats the problem. Array ele1 is same as ele2 except that it is transpose of ele0, but the refined triangles using ele1 is incorrect.
The problem is also reported at https://github.com/matplotlib/matplotlib/issues/4180
matplotlib version: 1.4.0, the UniformTriRefiner code in version 1.4.3 is the same as 1.4.0¡£
#!/bin/env python
import numpy as np
import matplotlib.tri as tri
import matplotlib.pyplot as plt
x = np.array([ 120.39299774, 120.59100342, 120.42900085, 120.31700134])
y = np.array([ 33.99900055, 34.00899887, 34.18799973, 34.18399811])
ele0 = np.array([[2, 2], [0, 1], [3, 0]])
ele1 = ele0.transpose() # ele1 is same as ele2 except that it is transpose of ele0
ele2 = np.array([[2, 0, 3], [2, 1, 0]])
triang1 = tri.Triangulation(x, y, ele1)
triang2 = tri.Triangulation(x, y, ele2)
refiner1 = tri.UniformTriRefiner(triang1)
refiner2 = tri.UniformTriRefiner(triang2)
fine_triang1 = refiner1.refine_triangulation(subdiv=1)
fine_triang2 = refiner2.refine_triangulation(subdiv=1)
fig = plt.figure()
ha1 = fig.add_subplot(121)
ha1.set_aspect('equal')
plt.triplot(fine_triang1, color='b', linewidth=0.5)
plt.triplot(triang1, color='k', linewidth=1)
plt.title('refine_triang1 is incorrect')
ha2 = fig.add_subplot(122)
ha2.set_aspect('equal')
plt.triplot(fine_triang2, color='b', linewidth=0.5)
plt.triplot(triang2, color='k', linewidth=1)
plt.title('refine_triang2 is correct')
plt.show()
Paul
The following code repeats the problem. Array ele1 is same as ele2 except that it is transpose of ele0, but the refined triangles using ele1 is incorrect.
The problem is also reported at https://github.com/matplotlib/matplotlib/issues/4180
matplotlib version: 1.4.0, the UniformTriRefiner code in version 1.4.3 is the same as 1.4.0¡£
#!/bin/env python
import numpy as np
import matplotlib.tri as tri
import matplotlib.pyplot as plt
x = np.array([ 120.39299774, 120.59100342, 120.42900085, 120.31700134])
y = np.array([ 33.99900055, 34.00899887, 34.18799973, 34.18399811])
ele0 = np.array([[2, 2], [0, 1], [3, 0]])
ele1 = ele0.transpose() # ele1 is same as ele2 except that it is transpose of ele0
ele2 = np.array([[2, 0, 3], [2, 1, 0]])
triang1 = tri.Triangulation(x, y, ele1)
triang2 = tri.Triangulation(x, y, ele2)
refiner1 = tri.UniformTriRefiner(triang1)
refiner2 = tri.UniformTriRefiner(triang2)
fine_triang1 = refiner1.refine_triangulation(subdiv=1)
fine_triang2 = refiner2.refine_triangulation(subdiv=1)
fig = plt.figure()
ha1 = fig.add_subplot(121)
ha1.set_aspect('equal')
plt.triplot(fine_triang1, color='b', linewidth=0.5)
plt.triplot(triang1, color='k', linewidth=1)
plt.title('refine_triang1 is incorrect')
ha2 = fig.add_subplot(122)
ha2.set_aspect('equal')
plt.triplot(fine_triang2, color='b', linewidth=0.5)
plt.triplot(triang2, color='k', linewidth=1)
plt.title('refine_triang2 is correct')
plt.show()
Paul