■ Polyline 클래스 : 아르키메데스 나선(Archimedes Spiral) 그리기

------------------------------------------------------------------------------------------------------------------------


TestProject.zip


MainPage.xaml

 

 

<Page x:Class="TestProject.MainPage"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">

        <Polyline Name="polyline"

            HorizontalAlignment="Center"

            VerticalAlignment="Center"

            Stroke="{StaticResource ApplicationForegroundThemeBrush}"

            StrokeThickness="3" />

    </Grid>

</Page>

 


MainPage.xaml.cs

 

 

using System;

using Windows.Foundation;

using Windows.UI.Xaml.Controls;

 

namespace TestProject

{

    /// <summary>

    /// 메인 페이지

    /// </summary>

    public sealed partial class MainPage : Page

    {

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor

        ////////////////////////////////////////////////////////////////////////////////////////// Public

 

        #region 생성자 - MainPage()

 

        /// <summary>

        /// 생성자

        /// </summary>

        public MainPage()

        {

            InitializeComponent();

 

            for(int angle = 0; angle < 3600; angle++)

            {

                double radian = Math.PI * angle / 180;

                double radius = angle / 10;

                double x      = 360 + radius * Math.Sin(radian);

                double y      = 360 + radius * Math.Cos(radian);

 

                this.polyline.Points.Add(new Point(x, y));

            }

        }

 

        #endregion

    }

}

 

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker

댓글을 달아 주세요