<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 29 11:00:15 2021

@author: conda
"""
from numpy import array,cross

class Triangle:
    def __init__(self , A, B, C):
        self._A = array(A)
        self._B = array(B)
        self._C = array(C)
        self._a = self._C - self._B
        self._b = self._C - self._A
        self._c = self._B - self._A
    def setB(self, B):
        self._B = B
        self._a = self._C - self._B
        self._c = self._B - self._A
    def getB(self):
        return self._B
    
    def delPoint(self):
        raise Exception("A triangle needs 3 points")
    # property looks like an attribute on the outside    
    B=property(fget = getB , fset = setB, fdel = delPoint)

    def area(self):
        return abs(cross(self._b, self._c))/2
   
   
tr = Triangle([0.,0.], [1.,0], [0., 1.])

print(tr.area())

# change one point
tr.B = array([2, -1])

# new area should be 1.0
print(f"new area is {tr.area()}") 

#del tr.B
</pre></body></html>