コード例 #1
0
ファイル: threeDplotter.py プロジェクト: spac3nerd/pyPlotWeb
def getMaxMin(plots, rangeObj):
    minVal = 0
    maxVal = 0
    for k in range (0, len(plots)):
        for n in range(0, len(plots[k])):
            if (plots[k][n] > maxVal):
                maxVal = plots[k][n]
            if (plots[k][n] < minVal):
                minVal = plots[k][n]
    return {
            "max": clampNumber(maxVal, rangeObj["zMin"], rangeObj["zMax"]),
            "min": clampNumber(minVal, rangeObj["zMin"], rangeObj["zMax"])
            }
コード例 #2
0
ファイル: plotter.py プロジェクト: AdamHanafi/pyPlotWeb
def getVerticalPoint(point, rangeObj, canvasSize):
    yVal = 0
    #Clamp the values so that large values do not cause visual issue for the client
    clampPoints = {
                   "min": -100000,
                   "max": 100000
                   }
    #Point is above yMax
    if ((point - rangeObj["yMax"]) > 1 ):
        yVal = ((point - rangeObj["yMax"]) / (rangeObj["yMax"] - rangeObj["yMin"]) * -canvasSize["height"] )
    
    #point is below yMin
    if ((point - rangeObj["yMin"]) < -1):
        yVal = (-1 * ((point - rangeObj["yMin"]) / (rangeObj["yMax"] - rangeObj["yMin"]) * canvasSize["height"]) + canvasSize["height"])
    
    #Point must be in range
    else:
        yVal = ((canvasSize["height"] / 2) - (point / (rangeObj["yMax"] - rangeObj["yMin"]) * canvasSize["height"]))
    
    return clampNumber(yVal, clampPoints["min"], clampPoints["max"])