본문 바로가기

Unity/C# 언어

Mathf.Sin, Mathf.Cos Mathf.Deg2Rad, 삼각함수 디버깅

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class MathfSinCosPrint : MonoBehaviour {
  5.  
  6.     // Use this for initialization
  7.     void Start () {
  8.         print("삼각함수");
  9.        
  10.         float sin0 = Mathf.Sin(0 * Mathf.Deg2Rad);
  11.         print("sin0 = 0 ," + sin0);
  12.         float sin30 = Mathf.Sin(30 * Mathf.Deg2Rad);
  13.         print("sin30  = 1/2 ," + sin30);
  14.         float sin45 = Mathf.Sin(45 * Mathf.Deg2Rad);
  15.         print("sin45 = 루트2/2 ," + sin45);
  16.         float sin60 = Mathf.Sin(60 * Mathf.Deg2Rad);
  17.         print("sin60 = 루트3/2 ," + sin60);
  18.         float sin90 = Mathf.Sin(90 * Mathf.Deg2Rad);
  19.         print("sin90 = 1 ," + sin90);
  20.        
  21.         float cos0 = Mathf.Cos(0 * Mathf.Deg2Rad);
  22.         print("cos0 = 1 ,"+cos0);
  23.         float cos30 = Mathf.Cos(30 * Mathf.Deg2Rad);
  24.         print("cos30 = 루트3/2 ," + cos30);
  25.         float cos45 = Mathf.Cos(45 * Mathf.Deg2Rad);
  26.         print("cos45 = 루트2/2  ," + cos45);
  27.         float cos60 = Mathf.Cos(60 * Mathf.Deg2Rad);
  28.         print("cos60 = 1/2  ,"+cos60);
  29.         double cos90 = Mathf.Cos(90 * Mathf.Deg2Rad);
  30.         print("cos90 = 0  ," + cos90);
  31.         int m10 = Mathf.Abs(-10);
  32.         print ("Mathf.Abs(-10)" + m10);
  33.        
  34.     }
  35.    
  36.     // Update is called once per frame
  37.     void Update () {
  38.    
  39.     }
  40. }




cos 90 이상함





'Unity > C# 언어' 카테고리의 다른 글

LateUpdate 함수 번역  (0) 2016.02.05
하얀소닉 코드 선언 방식 가이드라인 참조  (0) 2015.11.11
generic class serialization Unity3d  (0) 2014.12.25
pow 제곱 연산  (0) 2014.04.04