def __setMouseSpline(self, spline): self.__spline = Math.Curve(list(spline.p), spline.pointCount) frontPoint = Math.Vector2(0.0, spline.p[-1].y) beckPoint = Math.Vector2(1.0, 1.0) if frontPoint.y else Math.Vector2(1.0, 0.0) self.__smoothSpline = Math.Curve([frontPoint, beckPoint], 10) self.__spline.refresh() self.__smoothSpline.refresh()
def _reInit(self, params): self._params = self._strFormat(params) allVectors = self._getVectorData(params) X = sorted(map(lambda e: e.x, allVectors)) minX, maxX = X[0], X[-1] Y = sorted(map(lambda e: e.y, allVectors)) minY, maxY = Y[0], Y[-1] diffX = maxX - minX diffY = maxY - minY for vector in allVectors: vector.x -= minX vector.x /= diffX vector.y -= minY vector.y /= diffY self._curve = Math.Curve(allVectors, self._count) self._curve.refresh()
def __setMouseSpline(self, spline): self.__spline = Math.Curve(list(spline.p), spline.pointCount) self.__smoothSpline = Math.Curve([Math.Vector2(0.0, spline.p[-1].y), Math.Vector2(1.0, 1.0)], 10) self.__spline.refresh() self.__smoothSpline.refresh()
def _reInit(self, params): self._params = self._strFormat(params) self._curve = Math.Curve(self._getVectorData(params), self._count) self._curve.refresh()