日本語 English

2D

Samples


Right Triangle (RightTriangle)

Enter any two of side ab, height, side ca and the angle at a, then execute to calculate and output the items not entered

Right triangle calculation
Right triangle calculation function
Input
ab
Base length
h
Height
ca
Hypotenuse length
angle
Angle
Output
out_ab
Base length (output)
out_h
Height (output)
out_ca
Hypotenuse length (output)
out_angle
Angle (output)

Example

Right triangle calculation example
Input
ab
3.0
h
4.0
ca
angle
Output
out_ab
3.0
out_h
4.0
out_ca
5.0
out_angle
53.13

Formulas

\begin{align} \theta =& angle*\frac{\pi}{180} \\ h =& ab \cdot tan\theta &= ca \cdot sin\theta \\ ab =& ca \cdot cos\theta \end{align}


Polygon Enclosed by Points (PolygonArea)

Outputs the area and perimeter of a polygon connecting up to 10 points on the coordinate plane

Polygon enclosed by points
Calculation function for a polygon enclosed by points
Input
points
Point coordinates [x1,y1,x2,y2...]
n
Number of points
Output
area
Area
perimeter
Perimeter

Example

Calculation example for a polygon enclosed by points
Input
poits
[0.0,0.0] [2.0,0.0] [3.0,2.0] [1.5,2.5] [-1.0,2.0]
n
5
Output
area
7.0
perimeter
10.60

Formulas

\[ area = \frac{1}{2} \left|\sum_{j=1}^{n} (x_{j}-x_{j+1})*(y_{j}+y_{j+1})\right| \] \[ perimeter = \sum_{j=1}^{n} \sqrt{(x_{j}-x_{j+1})^{2}+(y_{j}-y_{j+1})^{2}}\ \]


Inscribed Circle of a Triangle (TriangleInCircle)

Outputs the radius and area of the inscribed circle of a triangle with the three side lengths specified

Inscribed circle of a triangle
Calculation function for the inscribed circle of a triangle
Input
ab
Length of side 1
bc
Length of side 2
ca
Length of side 3
Output
r
Radius
area
Area

Example

Calculation example for the inscribed circle of a triangle
Input
ab
3.0
bc
4.0
ca
5.0
Output
r
1.0
area
3.14

Formulas

\[ s = \frac{ab+bc+ca}{2} \] \[ r = \frac{\sqrt{s(s-ab)(s-bc)(s-ca)}}{s} \] \[ area = \pi r^{2} \]


Circumscribed Circle of a Triangle (TriangleCircumCircle)

Outputs the radius and area of the circumscribed circle of a triangle with the three side lengths specified

Circumscribed circle of a triangle
Calculation function for the circumscribed circle of a triangle
Input
ab
Length of side 1
bc
Length of side 2
ca
Length of side 3
Output
r
Radius
area
Area

Example

Calculation example for the circumscribed circle of a triangle
Input
ab
3.0
bc
4.0
ca
5.0
Output
r
2.5
area
19.64

Formulas

\[ s = \frac{ab+bc+ca}{2} \] \[ r = \frac{ab\cdot bc\cdot ca}{4\sqrt{s(s-ab)(s-bc)(s-ca)}} \] \[ area = \pi r^{2} \]


Inscribed Circle of a Regular Polygon (RegularPolygonInCircle)

Outputs the radius and area of the inscribed circle of a regular polygon with the side length specified

Inscribed circle of a regular polygon
Calculation function for the inscribed circle of a regular polygon
Input
l
Side length
n
Number of sides
Output
r
Radius
area
Area

Example

Calculation example for the inscribed circle of a regular polygon
Input
l
1.0
n
5
Output
r
0.69
area
1.49

Formulas

\[ r = \frac{l}{2tan\frac{\pi}{n}} \] \[ area = \pi r^{2} \]


Circumscribed Circle of a Regular Polygon (RegularPolygonCircumCircle)

Outputs the radius and area of the circumscribed circle of a regular polygon with the side length specified

Circumscribed circle of a regular polygon
Function for the circumscribed circle of a regular polygon
Input
l
Side length
n
Number of sides
Output
r
Radius
area
Area

Example

Calculation example for the circumscribed circle of a regular polygon
Input
l
1.0
n
5
Output
r
0.85
area
2.27

Formulas

\[ r = \frac{l}{2sin\frac{\pi}{n}} \] \[ area = \pi r^{2} \]


Distance and angle between two points (LinearPtoP)

Calculation function for the distance and angle between two points
Input
p1
Point 1 [x,y]
p2
Point 2 [x,y]
Output
distance
Distance
angle
Angle

Example

Calculation example for the distance and angle between two points
Input
p1
[-6.0,-3.0]
p2
[5.0,4.0]
Output
distance
13.038
angle
32.471

Formulas

\[ distance = \sqrt{(p2_x-p1_x)^{2}+(p2_y-p1_y)^{2}} \] \[ angle = atan2(p2_y-p1_y, p2_x-p1_x) \]

In the formulas, p1[0] is written as \(p1_x\) and p1[1] as \(p1_y\)


Intersection and angle of two lines (Intersection)

Input
Line1
Line 1 [start x, start y, end x, end y]
Line2
Line 2 [start x, start y, end x, end y]
Output
point
Intersection
angle
Angle

Example

Calculation example for the intersection and angle of two lines
Input
Line1
[-10, -7, 10, 3]
Line2
[-10, 13.4, 10, -10.6]
Output
point
[2,-1]
angle
-76.759

Formulas

Convert L1 to a linear function (ax+b) \[ \begin{align} P1=&(L1[0,0],L1[0,1]) \\ P2=&(L1[1,0],L1[1,1]) \\ a1=&\frac{(P2_y-P1_y)}{(P2_x-P1_x)} \\ b1=&\frac{(P2_x*P1_y-P1_x*P2_y)}{(P2_x-P1_x)} \end{align} \] Likewise convert L2 to a linear function (ax+b) and calculate \(a2,b2\)

From L1 and L2 \[ \begin{align} point_x = &\frac{(b2-b1)}{(a1-a2)} \\ point_y = &a1*point_x+b1 \\ angle=&tan^{-1}\left(\frac{a2-a1}{1+a1*a2} \right) \end{align} \]


Rotation around the origin (PointRotate)

Calculation function for rotation about the origin
Input
p
Point [x,y]
angle
Rotation angle
Output
out_point
Coordinates after rotation

Example

Calculation example for rotation about the origin
Input
p
[4, 4]
angle
90.0
Output
out_point
[-4, 4]

Formulas

\[ \begin{align} \theta =& angle\frac{\pi}{180} \\ outp_x =& p_x*cos\theta-p_y*sin\theta \\ outp_y =& p_x*sin\theta+p_y*cos\theta \\ \end{align} \]

In the formulas, p[0] is written as \(p_x\) and p[1] as \(p_y\)


Cartesian to Polar Coordinates (PolarCoordinates)

Converts Cartesian coordinates to polar coordinates

Cartesian to polar coordinates
Calculation function for Cartesian to polar coordinates
Input
p
Point [x,y]
Output
length
Length
angle
Angle

Example

Calculation example for Cartesian to polar coordinates
Input
p
[1.0,0.8]
Output
length
1.28
angle
38.66

Formulas

\begin{align} length =& \sqrt{p_x^{2}+p_y^{2}} \\ \theta =& tan^{-1}\frac{p_y}{p_x} \\ angle =& \frac{180}{\pi}\theta \end{align}

In the formulas, p[0] is written as \(p_x\) and p[1] as \(p_y\)
The quadrant problem for \(\theta\) can be avoided as follows. \[\theta = atan2(p_y,p_x) \]


Polar to Cartesian Coordinates (CartesianCoordinates)

Converts polar coordinates to Cartesian coordinates

Polar to Cartesian coordinates
Calculation function for polar to Cartesian coordinates
Input
length
Length
angle
Angle
Output
p
Point [x,y]

Example

Calculation example for polar to Cartesian coordinates
Input
length
2.0
angle
30.0
Output
p
[1.73,1.00]

Formulas

\begin{align} \theta =& angle\frac{\pi}{180} \\ p_x =& length\cdot cos\theta \\ p_y =& length\cdot sin\theta \end{align}

In the formulas, p[0] is written as \(p_x\) and p[1] as \(p_y\)


Finding the Center and Radius of the Circle Through Three Points on a Plane (GetCenter2D)

Find the center and radius of the circle through three points on a plane

Function that finds the center and radius of the circle through three points on a plane
Input
Point A
Point A [x,y]
Point B
Point B [x,y]
Point C
Point C [x,y]
Output
p0
Center [x,y]
r
Radius

Example

Calculation example for finding the center and radius of the circle through three points on a plane
Input
Point A
[-4, 2]
Point B
[3, -1]
Point C
[1, 6]
Output
p0
[0.128, 1.965]
r
4.128

Formulas

\[ a = \begin{bmatrix} A_x & A_y & 1 \\ B_x & B_y & 1 \\ C_x & C_y & 1 \end{bmatrix} \] \[ bx = \begin{bmatrix} A_x^{2}+A_y^{2} & A_y & 1 \\ B_x^{2}+B_y^{2} & B_y & 1 \\ C_x^{2}+C_y^{2} & C_y & 1 \end{bmatrix} \] \[ by = \begin{bmatrix} A_x^{2}+A_y^{2} & A_x & 1 \\ B_x^{2}+B_y^{2} & B_x & 1 \\ C_x^{2}+C_y^{2} & C_x & 1 \end{bmatrix} \] \begin{align} p0_x=&-\left(\frac{bx}{2a}\right) \\ p0_y=&-\left(\frac{by}{2a}\right) \\ r=&\sqrt{(A_x-p0_x)^2+(A_y-p0_y)^2} \end{align}

In the formulas, A[0] is written as \(A_x\) and A[1] as \(A_y\)


Download

Download the calculation library here

Comments