# 纤维束横截面三种表示方法

Please refresh the page if equations are not rendered correctly.
---------------------------------------------------------------

1.椭圆

\begin{aligned}C(v)_x&=\frac{w}{2}\mathrm{cos}(2\pi v)&&0\leq v\leq1\\C(v)_y&=\frac{h}{2}\mathrm{sin}(2\pi v)&&0\leq v\leq1\end{aligned}

import numpy as np
import matplotlib.pyplot as plt
import math

"""Ellipse"""
def C_xy(v, w, h):
x = w/2 * math.cos(2*np.pi*v)
y = h/2 * math.sin(2*np.pi*v)
return x, y

w = 1 #the width of the yarn cross section
h = 2 #the height of the yarn cross section
v = np.arange(0, 1.01, 0.01)
x = []
y = []
for i in v:
x_1, y_1 = C_xy(i, w, h)
x.append(x_1)
y.append(y_1)

plt.plot(x, y)
plt.xlabel('x')
plt.ylabel('y')
plt.title('Ellipse')
plt.show()



2.幂椭圆

\begin{array}{rcl}\mathbf{C}(v)_x&=&\dfrac{w}{2}\cos(2\pi v)\quad0\leq t\leq1\\{C}(v)_y&=&\begin{cases}&\dfrac{h}{2}(\sin(2\pi v))^n&\text{if }0\leq t\leq0.5\\&-\dfrac{h}{2}(-\sin(2\pi v))^n&\text{if }0.5\leq t\leq1\end{cases}\end{array}

import numpy as np
import matplotlib.pyplot as plt
import math

"""Power ellipse"""
def C_xy(v, w,h, n):
x = w / 2 * math.cos(2 * np.pi * v)
y =0
if v >= 0 and v <= 0.5:
y = (h/2) * math.sin(2*np.pi*v)**n
elif v >= 0.5 and v <= 1:
y = -(h/2)*(-math.sin(2*np.pi*v))**n
return x,y
# 定义参数
w = 1 #the width of the yarn cross section
h = 2 #the height of the yarn cross section
n = 2# power index
v = np.arange(0, 1.01, 0.01)
x = []
y = []
for i in v:
x_1, y_1 = C_xy(i, w, h,n)
x.append(x_1)
y.append(y_1)
plt.plot(x, y)
plt.xlabel('x')
plt.ylabel('y')
plt.title('Power ellipse')
plt.show()



3.透镜形状

"Automated geometric modelling of textile structures"

C(v)_x=\begin{cases}r_1\cos\theta+o_1&0\leq v\leq0.5\\-r_2\cos\theta+o_2&0.5\leq v\leq1\\\end{cases}\\C(v)_y=\begin{cases}r_1\cos\theta+o_1&0\leq v\leq0.5\\-r_2\cos\theta+o_2&0.5\leq v\leq1\end{cases}

\theta=\begin{cases}(1-4v)\sin^{-1}\left(\frac{w}{2r_1}\right)&0\leq v\leq0.5\\(-3+4v)\sin^{-1}\left(\frac{w}{2r_2}\right)_2&0.5\leq v\leq1\end{cases}

"Geometric and Mechanical Modelling of Textiles"

C(v)_x=\begin{cases}r_1\sin\theta&0\leq v\leq0.5\\r_2\sin\theta&0.5\leq v\leq1\\\end{cases}\\C(v)_y=\begin{cases}r_1\cos\theta+o_1&0\leq v\leq0.5\\-r_2\cos\theta+o_2&0.5\leq v\leq1\end{cases}

\theta=\begin{cases}(1-4v)\sin^{-1}\left(\frac{w}{2r_1}\right)&0\leq v\leq0.5\\(-3+4v)\sin^{-1}\left(\frac{w}{2r_2}\right)&0.5\leq v\leq1\end{cases}

import math
import matplotlib.pyplot as plt
import numpy as np

"""Lenticular
The lenticular cross-section is the intersection of two circles of radii r1 and r2 each offset
vertically by distances o1 and o2 respectively. """

def C_xy(v, w, r1, r2, o1, o2):
x = 0
y = 0

# 判断 (w / (2 * r1)) 和 (w / (2 * r2)) 的值是否在 -1 到 1 范围内
if not (-1 <= (w / (2 * r1)) <= 1) or not (-1 <= (w / (2 * r2)) <= 1):
return x, y

if v >= 0 and v <= 0.5:
theta = (1 - 4 * v) * math.asin(w / (2 * r1))
x = r1 * math.sin(theta)
y = r1 * math.cos(theta) + o1
elif v >= 0.5 and v <= 1:
theta = (-3 + 4 * v) * math.asin(w / (2 * r2))
x = r2 * math.sin(theta)
y = -r2 * math.cos(theta) + o2

return x, y
# 参数
w = 3 #the width of the yarn cross section
h = 2 #the height of the yarn cross section
d = 0.5 #distortion distance
r1 = (w ** 2 + (h - 2 * d) ** 2) / (4 * (h - 2 * d))
r2 = (w ** 2 + (h + 2 * d) ** 2) / (4 * (h + 2 * d))
o1 = -r1 + h / 2
o2 = r2 - h / 2
v = np.arange(0, 1.01, 0.01)
x = []
y = []
for i in v:
x_1, y_1 = C_xy(i, w, r1, r2, o1, o2)
x.append(x_1)
y.append(y_1)
plt.plot(x, y)
plt.xlabel('x')
plt.ylabel('y')
plt.title('Lenticular')
plt.show()



w=10，d=0时，绘制出来的图像

C(v)_x=\begin{cases}r_1\cos\theta&0\leq v\leq0.5\\r_2\cos\theta&0.5\leq v\leq1\\\end{cases}\\C(v)_y=\begin{cases}r_1\sin\theta+o_1&0\leq v\leq0.5\\-r_2\sin\theta+o_2&0.5\leq v\leq1\end{cases}

Everything not saved will be lost.