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


C# Vector3D.RotateXYBy方法代码示例

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


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

示例1: export_to_model_angular

        private void export_to_model_angular(LaserDataSceneNode node)
        {
            float min_angle = m_current_laser_buffer.get_min_angle();
            float ang_increment = m_current_laser_buffer.get_resolution() * m_mesh_resolution;

            uint num_h_samples = m_current_laser_buffer.get_distance_count();

            uint horizontal_count = num_h_samples / m_mesh_resolution;

            float vertical_increment = (m_vertical_sampler_max - m_vertical_sampler_min) / m_vertical_sampler_count;

            ushort sides = (ushort)horizontal_count;
            ushort slices = (ushort)m_vertical_sampler_count;

            // crear los vertices

            MeshBuffer mbuffer = node.get_mesh_buffer();

            uint vert_count = (uint)(sides * slices);

            mbuffer.AllocateVertices(vert_count);

            m_buffer_index = 0;
            float vertical_value = m_vertical_sampler_min;
            float angular_value = min_angle;

            for (ushort i = 0; i < slices; i++)
            {
                angular_value = min_angle;
                for (ushort j = 0; j < sides; j++)
                {
                    float distance = m_laser_distances[num_h_samples * i + j * m_mesh_resolution];
                    Vector3D pivot = new Vector3D();
                    Vector3D normal = new Vector3D();

                    normal.Z = -(float)Math.Cos(deg_to_rad((double)angular_value));
                    normal.Y = -(float)Math.Sin(deg_to_rad((double)angular_value));
                    normal.X = 0;
                    normal.RotateXYBy(vertical_value, new Vector3D());

                    //normal.X = (float)Math.Sin(deg_to_rad((double)vertical_value)); ;

                    pivot.Z = normal.Z * distance;
                    pivot.Y = normal.Y * distance;
                    pivot.X = normal.X * distance;

                    Vertex3D newvertex = new Vertex3D();

                    newvertex.Position = pivot;
                    newvertex.Normal = normal;
                    newvertex.Color = new Color(255, 255, 0, 100);
                    newvertex.TCoords = new Vector2D(1, 1);

                    mbuffer.SetVertex(m_buffer_index, newvertex);
                    m_buffer_index++;

                    angular_value += ang_increment;

                }

                vertical_value += vertical_increment;
            }

            create_model_indices(node, sides, slices);
        }
开发者ID:uplusplus,项目名称:ubuntu-android-env,代码行数:65,代码来源:LaserData3D.cs


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