Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Junjun Guo authored Jan 16, 2021
1 parent c22533f commit 4fab392
Show file tree
Hide file tree
Showing 18 changed files with 29,986 additions and 0 deletions.
3,418 changes: 3,418 additions & 0 deletions circle.eps

Large diffs are not rendered by default.

Binary file added circle.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3,181 changes: 3,181 additions & 0 deletions circleHole.eps

Large diffs are not rendered by default.

Binary file added circleHole.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions circleHole_Example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
######################################################################################
# Author: Junjun Guo
# E-mail: [email protected]/[email protected]
# Date: 1/16/2021
# Environemet: Successfully excucted in python 3.8
######################################################################################
from sectionFiberMain import circleSection
name="circleHole" #section name
outD = 2 # the diameter of the outside circle
coverThick = 0.06 # the thinckness of the cover concrete
outbarD = 0.03 # outside bar diameter
outbarDist = 0.15 # outside bar space
coreSize = 0.1 # the size of core concrete fiber
coverSize = 0.1 # the size of cover concrete fiber
plotState = True # plot the fiber or not plot=True or False
inD =1 # the diameter of the inside circle
inBarD=0.03 # inside bar diameter
inBarDist=0.15 # inside bar space
corFiber, coverFiber, barFiber = circleSection(name,outD, coverThick, outbarD, outbarDist, coreSize, coverSize,
plotState,inD,inBarD,inBarDist)
16 changes: 16 additions & 0 deletions circle_Example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
######################################################################################
# Author: Junjun Guo
# E-mail: [email protected]/[email protected]
# Date: 1/16/2021
# Environemet: Successfully excucted in python 3.8
######################################################################################
from sectionFiberMain import circleSection
name="circle"#section name
outD=2 # the diameter of the outside circle
coverThick=0.05 # the thinckness of the cover concrete
outbarD=0.03 # outside bar diameter
outbarDist=0.15 # outside bar space
coreSize=0.1 # the size of core concrete fiber
coverSize=0.1 # the size of cover concrete fiber
plotState=True # plot the fiber or not plot=True or False
corFiber,coverFiber,barFiber=circleSection(name,outD, coverThick, outbarD, outbarDist, coreSize, coverSize,plotState)
836 changes: 836 additions & 0 deletions fiberGenerate.py

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions pointInPolygon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#-*-coding: UTF-8-*-
######################################################################################
# Author: Junjun Guo
# E-mail: [email protected]/[email protected]
# Date: 05/02/2020
######################################################################################
######################################################################################
import numpy as np
import math
######################################################################################
def is_in_2d_polygon(point, vertices):
"""determine whether the point in the closed curved lines composed of vertices"""
px = point[0]
py = point[1]
angle_sum = 0

size = len(vertices)
if size < 3:
raise ValueError("len of vertices < 3")
j = size - 1
for i in range(0, size):
sx = vertices[i][0]
sy = vertices[i][1]
tx = vertices[j][0]
ty = vertices[j][1]
#determine whether the node in a line based on the distance from the node to the line
# y = kx + b, -y + kx + b = 0
k = (sy - ty) / (sx - tx + 0.000000000001) # avoid divide zero
b = sy - k * sx
dis = np.abs(k * px - 1 * py + b) / np.sqrt(k * k + 1)
if dis < 0.000001: #the node in the line
if sx <= px <= tx or tx <= px <= sx: #the node in the line
return True
#calculate the angle
angle = math.atan2(sy - py, sx - px) - math.atan2(ty - py, tx - px)
#the angle shoule with [-pi,pi]
if angle >= math.pi:
angle = angle - math.pi * 2
elif angle <= -math.pi:
angle = angle + math.pi * 2
#cumulation
angle_sum += angle
j = i
#calculate the diffrence between the sum angles and 2pi with a small threshold
return np.abs(angle_sum - math.pi * 2) < 0.00000000001
########################################################################################
#
# closedNodeValues=[[0,0],[2,0],[2,1],[1,1],[1,2],[2,2],[2,3],[0,3],[0,0]]
# print(is_in_2d_polygon([1.01,1.01], closedNodeValues))
Loading

0 comments on commit 4fab392

Please sign in to comment.