当前位置: 首页>>代码示例>>C#>>正文


C# Entity.getVolumeFromAtomCount方法代码示例

本文整理汇总了C#中Entity.getVolumeFromAtomCount方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.getVolumeFromAtomCount方法的具体用法?C# Entity.getVolumeFromAtomCount怎么用?C# Entity.getVolumeFromAtomCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entity的用法示例。


在下文中一共展示了Entity.getVolumeFromAtomCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: layout

    public static void layout(Entity subset, float delay = 0.0f)
    {
        float parentVolume = 0.0f;

        if (subset.parent == null)
        {
            return;
        }
            
        parentVolume = subset.parent.boundingBoxW * subset.parent.boundingBoxH * subset.parent.boundingBoxD;

        float subsetAC = subset.getVolumeFromAtomCount();
        float totalAC = subset.parent.getVolumeFromAtomCount();

        float width = (subsetAC / totalAC) * subset.parent.boundingBoxW;

        //seed all sub-entities into the bounding volume
        foreach (Entity e in subset.entities)
        {
            float x = Random.Range(0.0f, subset.parent.boundingBoxD);
            float y = Random.Range(0.0f, subset.parent.boundingBoxH);
            float z = Random.Range(0.0f, width);

            e.transformEntity(new Vector3(x - subset.parent.boundingBoxD * 0.5f,
                                          y - subset.parent.boundingBoxH * 0.5f,
                                          z - subset.parent.boundingBoxW * 0.5f), delay);
        }

        subset.boundingBoxD = subset.parent.boundingBoxD;
        subset.boundingBoxH = subset.parent.boundingBoxH;
        subset.boundingBoxW = width;
    }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:32,代码来源:PartialLayout.cs

示例2: layout

    public static void layout(Entity subset, float delay = 0.0f)
    {
        //get the total volume of all its sub-entities
        float totalVolume;
        if (LayoutParams.Get.barLayout.useAtomCount)
        {
            float numAtoms = subset.getVolumeFromAtomCount();
            totalVolume = numAtoms * TrannimationManager.atomDensity;
        }
        else
            totalVolume = subset.getVolumeFromBoundingSphere();
        //float totalVolume = subset.getVolumeFromAtomCount();

        //create a new bounding volume that will house all sub-entities
        //for this we need a base that we will fill
        float baseWidth = 100;
        float baseDepth = 100;
        float height = totalVolume / (baseWidth * baseDepth) * /*0.02f*/ /*0.003f*/ 0.01f;

        subset.boundingBoxW = baseWidth;
        subset.boundingBoxD = baseDepth;
        subset.boundingBoxH = height;

        Vector3 entryPoint = new Vector3(baseWidth * 0.5f, baseDepth * 0.5f, height);

        //seed all sub-entities into the bounding volume
        int counter = 0;

        //subset.entities.Sort()
        subset.entities.Sort(delegate (Entity x, Entity y)
        {
            return (int)(x.center.y - y.center.y);
            /*if (x.center.y == null && y.PartName == null) return 0;
            else if (x.PartName == null) return -1;
            else if (y.PartName == null) return 1;
            else return x.PartName.CompareTo(y.PartName);*/
        });

        foreach (Entity e in subset.entities)
        {
            /*float x = Random.Range(0.0f, baseWidth);
            float y = Random.Range(0.0f, height);
            float z = Random.Range(0.0f, baseDepth);*/

            float x = 0.0f;
            float y = ((float)counter / (float)subset.entities.Count) * height;
            float z = 0.0f;

            counter++;

            e.transformEntity(new Vector3(x, /*height*1.5f*/ 2000.0f, baseWidth * 0.5f), delay);
            e.newStage = true;
            e.transformEntity(new Vector3(x, y, z), delay);
        }
    }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:55,代码来源:SplitLayout.cs

示例3: layout

    public static void layout(Entity subset, float delay = 0.0f)
    {
        //get the total volume of all its sub-entities
        float totalVolume;
        if (LayoutParams.Get.barLayout.useAtomCount)
        {
            float numAtoms = subset.getVolumeFromAtomCount();
            totalVolume = numAtoms * TrannimationManager.atomDensity;
        }
        else
            totalVolume = subset.getVolumeFromBoundingSphere();
        //float totalVolume = subset.getVolumeFromAtomCount();

        //create a new bounding volume that will house all sub-entities
        //for this we need a base that we will fill
        float baseWidth = 200;
        float baseDepth = 200;
        float height = totalVolume / (baseWidth * baseDepth) * 0.02f;

        subset.boundingBoxW = baseWidth;
        subset.boundingBoxD = baseDepth;
        subset.boundingBoxH = height;

        Vector3 entryPoint = new Vector3(baseWidth * 0.5f, baseDepth * 0.5f, height);

        //seed all sub-entities into the bounding volume
        foreach (Entity e in subset.entities)
        {
            float x = Random.Range(0.0f, baseWidth);
            float y = Random.Range(0.0f, height);
            float z = Random.Range(0.0f, baseDepth);

            e.transformEntity(new Vector3(x, height * 1.5f, baseWidth * 0.5f), delay);
            e.newStage = true;
            e.transformEntity(new Vector3(x, y, z), delay);
        }
    }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:37,代码来源:RandomBarLayout.cs

示例4: layout

    public static void layout(Entity subset, float delay = 0.0f)
    {
        //get the total volume of all its sub-entities
        float totalVolume;
        if (LayoutParams.Get.barLayout.useAtomCount)
        {
            float numAtoms = subset.getVolumeFromAtomCount();
            totalVolume = numAtoms * TrannimationManager.atomDensity;
        }
        else
            totalVolume = subset.getVolumeFromBoundingSphere();

        //create a new bounding volume that will house all sub-entities
        //for this we need a base that we will fill
        float baseHeight = subset.boundingBoxH;
        float baseDepth = subset.boundingBoxD;
        float width = totalVolume / (baseHeight * baseDepth);

        //#warning: this should already be known        
        //subset.boundingBoxD = baseDepth;
        //subset.boundingBoxH = baseHeight;
        subset.boundingBoxW = width;

        //#warning: entrypoint not yet used
        Vector3 entryPoint = new Vector3(width * 0.5f, baseDepth * 0.5f, baseHeight);

        //seed all sub-entities into the bounding volume
        foreach (Entity e in subset.entities)
        {
            float x = Random.Range(0.0f, width);
            float y = Random.Range(0.0f, baseHeight);
            float z = Random.Range(0.0f, baseDepth);

            e.transformEntity(new Vector3(x, y, z), delay);
        }
    }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:36,代码来源:SliceLayout.cs


注:本文中的Entity.getVolumeFromAtomCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。