[Question]
  [
Given 4 points on the 2D planes `A, B, C, D`, calculate the area of the intersection region of the triangles `OAB` and `OCD`, where `O` is the center of the plane, having coordinate `(0, 0)`.
Algorithms that runs in constant time complexity (in terms of arithmetic operations) are encouraged, but not forced.
# Rules
* Each point is represented as two real numbers, denotes their X and Y coordinate.
	+ Optionally, if your programming language (or some library of your programming language) has built-in `Point` type or equivalent, it is allowed to take `Point` object as input.
* The input is given as 4 points, in the formats, including but not limited to:
	+ A list of 8 coordinates.
	+ A list of 4 points, each point can be represented in any convenient format.
	+ Two lists of 2 points.
	+ etc.
* You cannot assume particular ordering of the points (counter-clockwise order or clockwise order)
* You cannot assume that the point `O` is passed as input. In other word, program must not take and use extraneous input.
* You cannot assume all the points are different. In other words, the triangles may be degenerate. You need to also handle that case (see test cases below)
* The absolute or relative difference must be less than `10-3` for the sample test cases below.
# Winning criteria
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), the shortest answer in bytes win!
# Sample test cases
```
Ax Ay Bx By Cx Cy Dx Dy area
5 1 1 3 -1 0 0 -1 0
5 1 1 3 -1 0 0 0 0
5 1 1 3 0 0 0 0 0
5 1 1 3 3 4 4 -3 4.50418
5 1 1 3 1 2 2 1 1.5
5 1 1 3 -2 5 4 -2 1.74829
5 1 1 3 -2 5 5 4 2.96154
5 1 1 3 3 5 5 4 1.88462
5 1 1 3 3 5 3 1 3.92308
5 1 1 3 3 5 4 -1 5.26619
5 1 1 3 5 1 4 -1 0
5 1 1 3 5 1 1 3 7
1 3 1 3 5 1 1 3 0
1 3 1 3 1 3 1 3 0
4 8 4 -1 -2 6 -2 -3 0
1.2 3.4 -0.3 4.2 5 7.6 -1.1 2.4 2.6210759326188535
3.1 0.6 0.1 7.2 5.2 0.7 0.9 8 9.018496993987977
```
If anyone want, here are the outputs for the first test case group in exact form:
```
0
0
0
46375/10296
3/2
1792/1025
77/26
49/26
51/13
23345/4433
0
7
0
0
0
```
Illustration image for test case `5 1 1 3 3 4 4 -3` (the area of the green quadrilateral is the expected output):
[![Image](https://i.snag.gy/FqhUSz.jpg)]
  
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 55 bytes
```
0&@@Area@BooleanRegion[And,Simplex[{0{,}}~Join~#]&/@#]&
```
[Try it online!](https://tio.run/##jZRdS@QwFIbv91cEFsSVNOYkaZsMCNVLYXFZ926Yi6LtWHBS6cygUupfH8@ZTne0VlpCmrfJOU8@@qardPOQrdJNcZfubvJ8fvvqN@nLbHZXrhbs9Iz921aelXnOntPKF365Zme/flDg32xZlP6q3Pr79WxWZcvFh@7fWbreVtmhP7/YyZMkuayyNLkqy8cs9W3Y/NLf89ti9fSYvcxrWfOmebsuC//2c3FynuBj96cq/CbJk7quQ86g4awGznRDog5QSlKSswCapqEFhwywaOxgEgs1uOLJHDmMoTKGkfw7iJzM0JwZEgZ3pHsUzQyWABsRSgN2FIZKkVA08pkFTGFBLcJRTID5Ybco1T8fhdJQAyI2VrnpuJD2OkAjnhIugtBMOa8Dy3w5rZYEwloTqakgzWEARAemhVNa2qkgw4MhkiFHhUJFEbgxVNczgKLWtOacSgGuByDUxp8R@9QRROuhI0KOIY49fURXewg0m@1MB0fnRKRQ/L8dhtn2JNA7ET2Cr6sRmKjF/mIFUtAdE@qwM3yLRQsFAVyJzkeYRDmMEih@7wIMZRSH/jT9WbSg30jLkqTj4ySKRuJ2xHF7mAIzKAErUDDZgsKwOtyUExKscZFz2tnYxfSVdu8 "Wolfram Language (Mathematica) – Try It Online")
Shaved a few bytes off the trivial answer.
```
%@{{{5, 1}, {1, 3}}, {{3, 4}, {4, -3}}} yields 46375/10296 or 4.504176379
```
Replacing `Area` with `DiscretizeRegion` will show the intersection.
[![enter image description here](https://i.stack.imgur.com/b8c0F.png)](https://i.stack.imgur.com/b8c0F.png)
By the way, this will work with any simplexes, not just triangles.
-1 Byte thanks to JungHwan Min
@user202729's suggestion added 4 bytes but makes it yield 0 for degenerate triangles
[Answer]
# [Python 2](https://docs.python.org/2/) + PIL, ~~341~~ ~~318~~ ~~313~~ ~~284~~ 270 bytes
Special thanks to Dennis that promptly added PIL on TIO   
-23 bytes thanks to Mr. Xcoder  
```
import PIL.Image as I,PIL.ImageDraw as D
l=[i*1000for i in[0,0]+input()+[0,0]]
z=zip(*[[i-min(t)for i in t]for t in l[::2],l[1::2]])
print sum(map(int.__mul__,*map(lambda i,c:D.Draw(i).polygon(c,1)or i.getdata(),map(I.new,'11',[[max(l)-min(l)]*2]*2),[z[:3],z[3:]])))/1e6
```
[Try it online!](https://tio.run/##PY5Ba4QwEIXv/orcNnFnU6NtD8LevAg99D4ESXddO5DE4Ea265@3Rmjhg3nvMcO88Izfoy/XlVwYp8g@2w/ZOjP0zNxZC/@2mcwjRU1mz0i5KoriNk6MGHksoNBH8mGOXBx3p7PlvFDgOSKdHHkexd82izrJmKTFui41WFRpapGFiXxk99lxZwLftOw6N9uugzwF1rivq2EEl7qRqREnIcNon8Po@QWUSD/k0MeriYYLSDet9P0DDkodANGZH27F3sgKnZcbAnDButKwYFVvHYR4Uf37uuIbMLVT7bzunCr9Cw "Python 2 – Try It Online") or [Try all test cases](https://tio.run/##hZJda8MgFIbv8yu8m3bGqTFZGuhdbwq72L1IcWvaCeaDxLKtf75T062wLgwOnhPfx5yXw@k/3VvX8vPZNH03OPC8eSKbRh9qoEewwT@f60G/h6t1sqv3YA97VCXArqRZMEr33QAMMK2kmKr7/j5mlYDT6mR6uJDSpI1poUPfIHAqlC6UVlYVV9hKFrJCCRhqdxxaMB4b2OgemtaR7bY52u0WL8KF1c3LTgODX6s1CcagQaTv7Oeha@ErZih0IYfa7bTTEOHwZkPa@h3fMXaHpWz0B7QoerJILbgPhOVJVpnCJ5lV3gVCD6wWZ1ePblxJKXMMWIwMg9QnGiNlymeicDJH0L8B@o/uQ8RIvSUgSE4FK28of/IYwQYj@a0Pr@XTf3hEHkXJl3NYID3FybJgufjL0xVipCxFwWegbLKUkSXPaDkDicv8csKLgt26mmoxP@Vr7fXHSf8ZzG@d3urX86r7duWl6TSXYkrpN6OSJK6uXwzsN3U82rjFcVGqfvDLetH2MGSEJ@b8BQ "Python 2 – Try It Online")
To calculate the diference this literally draw the triangles and check the amount of pixels that are painted in both images.  
This method inserted a rounding error, that is softened by increasing the image size. 
### Explanation
```
#the image/triangles are enlarged to increase the precision
#a pair of zeros are inserted in the start and at the end, this way "l" will have all 6 points to draw the triangles 
l=[i*1000for i in[0,0]+input()+[0,0]]
#split the input in x and y, where x=l[::2] and y=l[1::2]
#get the smallest number on each list, that will be "0" if there is no negative number, to be used as offset.
#this will be used to overcome the fact that PIL won't draw on negative coords
#zip "x" and "y" lists, to create a list containing the points
z=zip(*[[i-min(t)for i in t]for t in x,y])
#create 2 (B&W) blank images
#where the size is the difference between the smallest and the largest coord.
map(I.new,'11',[[max(l)-min(l)]*2]*2)
#draw both triangles and return the pixel list of each image
map(lambda i,c:D.Draw(i).polygon(c,1)or i.getdata(),<result of previous line>,[z[:3],z[3:]])
#count the amount of overlapping pixels by summing the color of each pixel, if the pixel is "1" in both images, then the triangles are overlapping, then the amount of pixels is divided by the initial enlarging factor squared (1e6)
print sum(map(int.__mul__,*<result of previous line>))/1e6
```
]