def __init__(self, *inargs): if len(inargs) == 1: self.vert = inargs[0] self.A, self.s, self.b = vert2con(self.vert) self.closed = True elif len(inargs) == 3: if all(sign(inargs[1]) == -1): # ensure an all -1 sign vector self.A, self.s, self.b = inargs else: self.A, self.s, self.b = mat2ab(c_[inargs]) self.vert, self.closed = con2vert(self.A, self.b) else: exit(1) # TODO: Raise exception self.nd = self.A.shape[1] self.cscent = sum(self.vert, axis=0)/len(self.vert)
def outconlin(self, model, iss, oss): """ Convert constraints to another space using a linear model e.g. calc AOS (from G and AIS). iss [vector] - nominal steady state of current space ("from") oss [vector] - nominal steady state of transformed space ("to") """ outverttemp = empty([1, self.vert.shape[1]]) # handle shifting ishift = self.cscent - iss #input space dev oshift = model*ishift.T #output space dev fshift = oshift.T + oss #output space offset # center 'input'-space around [0] inverttemp = self.vert - self.cscent for v in inverttemp: x = model*v.transpose() outverttemp = vstack((outverttemp, x.transpose())) # remove first line of junk data from outverttemp and shift outverttemp = outverttemp + fshift return vert2con(outverttemp[1:, :])