コード例 #1
0
    void ScaleGraph(float scale)
    {
        /*
         * Set the axes and labels
         */

        xRange[0] = -scale / 25f;  xRange[1] = scale / 25f;

        yRange[0] = -scale * yx_ratio / 25f;  yRange[1] = scale * yx_ratio / 25f;

        zRange[0] = 0; zRange[1] = 2 * scale * yx_ratio / 25f;

        GameObject.Find("MapImage").transform.localPosition = new Vector3(0, -yx_ratio * scale / 25f, yx_ratio * scale / 25f);
        // For now the Z range = Y range

        XLabel.transform.parent = transform;
        YLabel.transform.parent = transform;
        ZLabel.transform.parent = transform;
        xAxis.transform.parent  = transform;
        yAxis.transform.parent  = transform;
        zAxis.transform.parent  = transform;

        xAxis.transform.localPosition    = new Vector3(0, -yx_ratio * scale / 25f, 0);
        xAxis.transform.localEulerAngles = new Vector3(0, 0, 90);
        xAxis.transform.localScale       = new Vector3(0.05f, scale / 25f, 0.05f);

        yAxis.transform.localPosition = new Vector3(-scale / 25f, 0, 0);
        yAxis.transform.localScale    = new Vector3(0.05f, yx_ratio * scale / 25f, 0.05f);

        zAxis.transform.localPosition    = new Vector3(-scale / 25f, -yx_ratio * scale / 25f, yx_ratio * scale / 25f);
        zAxis.transform.localEulerAngles = new Vector3(90, 0, 0);
        zAxis.transform.localScale       = new Vector3(0.05f, yx_ratio * scale / 25f, 0.05f);

        XLabel.GetComponent <TextMesh>().anchor    = TextAnchor.MiddleCenter;
        XLabel.GetComponent <TextMesh>().fontStyle = FontStyle.Bold;
        YLabel.GetComponent <TextMesh>().anchor    = TextAnchor.MiddleCenter;
        YLabel.GetComponent <TextMesh>().fontStyle = FontStyle.Bold;
        ZLabel.GetComponent <TextMesh>().anchor    = TextAnchor.MiddleCenter;
        ZLabel.GetComponent <TextMesh>().fontStyle = FontStyle.Bold;

        XLabel.transform.localPosition = new Vector3(0, -scale * yx_ratio / 25f - 0.6f, 0);
        YLabel.transform.localPosition = new Vector3(-scale / 25f - 0.9f, 0, 0);
        ZLabel.transform.localPosition = new Vector3(-scale / 25f - 0.9f, -scale * yx_ratio / 25f - 0.4f, scale * yx_ratio / 25f);

        XLabel.transform.localScale = new Vector3(.02f, .02f, .02f);
        YLabel.transform.localScale = new Vector3(.02f, .02f, .02f);
        ZLabel.transform.localScale = new Vector3(.02f, .02f, .02f);
        YLabel.transform.Rotate(new Vector3(0, 0, 90));

        float pointSize = scale / 750f;

        DataPoint0.transform.localScale = new Vector3(pointSize, scale * yx_ratio / 25f, pointSize);
        DataPoint1.transform.localScale = new Vector3(pointSize, pointSize, pointSize);
        DataPoint2.transform.localScale = new Vector3(pointSize, pointSize, pointSize);
    }
コード例 #2
0
    void ScaleGraph(float scale)
    {
        /*
         * Set the axes and labels
         */

        xRange[0] = -scale / 25f;  xRange[1] = scale / 25f;

        yRange[0] = -scale * yx_ratio / 25f;  yRange[1] = scale * yx_ratio / 25f;


        XLabel.transform.parent = transform;
        YLabel.transform.parent = transform;
        xAxis.transform.parent  = transform;
        yAxis.transform.parent  = transform;

        xAxis.transform.localPosition    = new Vector3(0, -yx_ratio * scale / 25f, 0);
        xAxis.transform.localEulerAngles = new Vector3(0, 0, 90);
        xAxis.transform.localScale       = new Vector3(0.05f, scale / 25f, 0.05f);
        // 150: Pos (-1.6, 4.6, 0.0); Scale (8250.0, 50.0, 50.0); 250: Pos (-1.6, -1.8, 0.0); Scale (13750.0, 50.0, 50.0)

        yAxis.transform.localPosition = new Vector3(-scale / 25f, 0, 0);
        yAxis.transform.localScale    = new Vector3(0.05f, yx_ratio * scale / 25f, 0.05f);
        //Debug.Log("YAxis: Pos " + yAxis.transform.position.x + ", " + yAxis.transform.position.y + ", " + yAxis.transform.position.z + "; Scale " + +yAxis.transform.localScale.x + ", " + yAxis.transform.localScale.y + ", " + yAxis.transform.localScale.z);
        // 150:  Pos (-8.9, 11.2, 0.0); Scale (50.0, 3750.0, 50.0); 250: Pos (-13.7, 9.25, 0.0); Scale (50.0, 6250.0, 50.0)
        XLabel.GetComponent <TextMesh>().anchor    = TextAnchor.MiddleCenter;
        XLabel.GetComponent <TextMesh>().fontStyle = FontStyle.Bold;
        YLabel.GetComponent <TextMesh>().anchor    = TextAnchor.MiddleCenter;
        YLabel.GetComponent <TextMesh>().fontStyle = FontStyle.Bold;

        XLabel.transform.localPosition = new Vector3(0, -scale * yx_ratio / 25f - 0.6f, 0);
        YLabel.transform.localPosition = new Vector3(-scale / 25f - 0.9f, 0, 0);
        XLabel.transform.localScale    = new Vector3(.02f, .02f, .02f);
        YLabel.transform.localScale    = new Vector3(.02f, .02f, .02f);
        YLabel.transform.Rotate(new Vector3(0, 0, 90));

        float pointSize = scale / 750f;

        DataPoint0.transform.localScale = new Vector3(pointSize, pointSize, pointSize);
        DataPoint1.transform.localScale = new Vector3(pointSize, pointSize, pointSize);
        DataPoint2.transform.localScale = new Vector3(pointSize, pointSize, pointSize);
    }