Python | simpy triangle () method

Python Methods and Functions

The Trianlgle () function takes the given points as the vertices of a triangle and calculates the area of ​​the triangle using area.

  Syntax:  Triangle (x, y, z) .area  Parameters:  where x, y, z are coordinates.  Return:  Area of ​​triangle. 

Example # 1:

# import symposium and geometry module

from sympy import *  

from sympy.geometry import *  

 

x = Point ( 0 , 0 )

y = Point ( 1 , 1 )

z = Point ( 1 , 0 )

 
# Using triangle (x, y, z) .area

giveArea = Triangle (x, y, z) .area

 

print (giveArea)

Exit:

 1/2 

Example # 2:

# import symposium and geometry module

from sympy import  

from sympy.geometry import *  

 

x = Point ( 1 , 2 )

y = Point ( 2 , 0 )

z = Point ( 1 , 0 )

 
# Using a triangle (x, y, z) .area

giveArea = Triangle (x, y, z) .area

 

print (giveArea)

Exit:

 1 




Tutorials