모바일 오유 바로가기
http://m.todayhumor.co.kr
분류 게시판
베스트
  • 베스트오브베스트
  • 베스트
  • 오늘의베스트
  • 유머
  • 유머자료
  • 유머글
  • 이야기
  • 자유
  • 고민
  • 연애
  • 결혼생활
  • 좋은글
  • 자랑
  • 공포
  • 멘붕
  • 사이다
  • 군대
  • 밀리터리
  • 미스터리
  • 술한잔
  • 오늘있잖아요
  • 투표인증
  • 새해
  • 이슈
  • 시사
  • 시사아카이브
  • 사회면
  • 사건사고
  • 생활
  • 패션
  • 패션착샷
  • 아동패션착샷
  • 뷰티
  • 인테리어
  • DIY
  • 요리
  • 커피&차
  • 육아
  • 법률
  • 동물
  • 지식
  • 취업정보
  • 식물
  • 다이어트
  • 의료
  • 영어
  • 맛집
  • 추천사이트
  • 해외직구
  • 취미
  • 사진
  • 사진강좌
  • 카메라
  • 만화
  • 애니메이션
  • 포니
  • 자전거
  • 자동차
  • 여행
  • 바이크
  • 민물낚시
  • 바다낚시
  • 장난감
  • 그림판
  • 학술
  • 경제
  • 역사
  • 예술
  • 과학
  • 철학
  • 심리학
  • 방송연예
  • 연예
  • 음악
  • 음악찾기
  • 악기
  • 음향기기
  • 영화
  • 다큐멘터리
  • 국내드라마
  • 해외드라마
  • 예능
  • 팟케스트
  • 방송프로그램
  • 무한도전
  • 더지니어스
  • 개그콘서트
  • 런닝맨
  • 나가수
  • 디지털
  • 컴퓨터
  • 프로그래머
  • IT
  • 안티바이러스
  • 애플
  • 안드로이드
  • 스마트폰
  • 윈도우폰
  • 심비안
  • 스포츠
  • 스포츠
  • 축구
  • 야구
  • 농구
  • 바둑
  • 야구팀
  • 삼성
  • 두산
  • NC
  • 넥센
  • 한화
  • SK
  • 기아
  • 롯데
  • LG
  • KT
  • 메이저리그
  • 일본프로야구리그
  • 게임1
  • 플래시게임
  • 게임토론방
  • 엑스박스
  • 플레이스테이션
  • 닌텐도
  • 모바일게임
  • 게임2
  • 던전앤파이터
  • 마비노기
  • 마비노기영웅전
  • 하스스톤
  • 히어로즈오브더스톰
  • gta5
  • 디아블로
  • 디아블로2
  • 피파온라인2
  • 피파온라인3
  • 워크래프트
  • 월드오브워크래프트
  • 밀리언아서
  • 월드오브탱크
  • 블레이드앤소울
  • 검은사막
  • 스타크래프트
  • 스타크래프트2
  • 베틀필드3
  • 마인크래프트
  • 데이즈
  • 문명
  • 서든어택
  • 테라
  • 아이온
  • 심시티5
  • 프리스타일풋볼
  • 스페셜포스
  • 사이퍼즈
  • 도타2
  • 메이플스토리1
  • 메이플스토리2
  • 오버워치
  • 오버워치그룹모집
  • 포켓몬고
  • 파이널판타지14
  • 배틀그라운드
  • 기타
  • 종교
  • 단어장
  • 자료창고
  • 운영
  • 공지사항
  • 오유운영
  • 게시판신청
  • 보류
  • 임시게시판
  • 메르스
  • 세월호
  • 원전사고
  • 2016리오올림픽
  • 2018평창올림픽
  • 코로나19
  • 2020도쿄올림픽
  • 게시판찾기
  • 오유인페이지
    개인차단 상태
    잡담꾼님의
    개인페이지입니다
    가입 : 14-09-05
    방문 : 317회
    닉네임변경 이력
    회원차단
    회원차단해제
    게시물ID : programmer_13951
    작성자 : 다람쥐같이
    추천 : 0
    조회수 : 545
    IP : 222.113.***.202
    댓글 : 1개
    등록시간 : 2015/10/18 16:03:46
    http://todayhumor.com/?programmer_13951 모바일
    각도 없이 회전하는 코드 왜 안돌아가는지 확인 가능하신 분 계시나요...
    <b></b> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">#include <iostream></span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">#include <string></span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">#include <vector></span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">#include <math.h></span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">class Rotator {</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    public:</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    int c, d;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    double e, f;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    int p;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    double r, l;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    double A, B;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    //상대좌표, 기준 객체 중심점을 0, 0이라 하고 클릭된 지점</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    void set(int c, int d, int x, int y){</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        this->c = c;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        this->d = d;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        r = root((double)(c*c + d*d));</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        double R = root(x*x + y*y);</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        e = x*r/R;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        f = y*r/R;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        l = root((c-e)*(c-e)+(d-f)*(d-f));</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        int k = d*e-c*f;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        if(k > 0) p = 1;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        else if(k == 0) p = 0;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        else p = -1;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        A = 1 - l*l/2/r/r;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        B = p*l/r/r*root(r*r-l*l/4);</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    }</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    //inline</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    double root(double x){</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        //다른 라이브러리 참조를 래핑한 것</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        return sqrt(x);</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    }</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    void get(double a, double b, double& x, double& y){</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        x = A*a + B*b;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">        y = A*b - B*a;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    }</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">};</span></p><br><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">int main()</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">{</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    Rotator test;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    test.set(1, 0, 1, 1);</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    double a = -1, b = 1;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    double x, y;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    test.get(a, b, x, y);</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    //std::cout << x << " " << y << std::endl;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">    //std::cout << test.r;</span></p> <p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:14.666666666666666px;font-family:Arial;background-color:transparent;font-weight:400;vertical-align:baseline;white-space:pre-wrap;">}</span></p><br><div><b><br></b></div> <div><b>마우스가 클릭된 지점을 향하여 모든 점들을 같은 각도만큼 회전시키는 건데, </b></div> <div><b><br></b></div> <div><b>삼각형 합동을 이용한 거거든요. </b></div> <div><b><br></b></div> <div><b>각도값을 안구하고 하려는데... 확실히 되는 점이 있는데, 안되는 점들이 있어요... </b></div> <div><b><br></b></div> <div><b>제가 지금 설명할 시간이 없어서 코드에 주석은 못달았는데 </b></div> <div><b><br></b></div> <div><b>저 코드를 봐달라기 보다는... </b></div> <div><b><br></b></div> <div><b>혹시 오픈소스 중에 각도 안구하고 주어진 벡터를 이용해서(삼각형 합동으로) 회전하는 함수 없나요? 속시원하게 풀어버리고 싶은데... </b></div> <div><b><br></b></div> <div><b><br></b></div>

    이 게시물을 추천한 분들의 목록입니다.
    푸르딩딩:추천수 3이상 댓글은 배경색이 바뀝니다.
    (단,비공감수가 추천수의 1/3 초과시 해당없음)

    죄송합니다. 댓글 작성은 회원만 가능합니다.

    번호 제 목 이름 날짜 조회 추천
    75
    C++ 동적할당문 [9] 잡담꾼 17/08/31 09:34 66 0
    74
    URF 마오카이 현상황 [5] 잡담꾼 17/08/23 20:05 131 0
    73
    ... [8] 본인삭제금지 메이플페이스 17/08/08 00:49 59 0
    72
    파워서플라이 아무거나 사서 껴도 되나요??? +조립PC사이트추천좀... [6] 메이플페이스 17/08/06 11:25 92 10
    71
    전직 레벨 초과해서 전직하면 HP MP [5] 메이플페이스 17/08/02 03:28 95 0
    70
    C++에서 함수를 인자로 쓰려하는데 [3] 메이플페이스 17/07/14 04:39 80 0
    69
    하... 선택의 기로에 놓였다... (노진지) [1] 메이플페이스 17/07/14 01:17 63 2
    68
    평행우주가 있었으면 좋겠네요. [2] 빅폭력주의자 17/05/20 21:00 55 0
    67
    아이라 ㅠㅠ.... [1] 빅폭력주의자 17/05/04 11:25 56 4
    66
    게임 추천 받습니다 [8] 빅폭력주의자 17/04/30 23:53 87 2
    65
    손끝 피부가 꽤나 잘려나갔는데... [3] 다람쥐같이 16/03/11 01:53 43 0
    64
    crypt of the necrodancer [5] 다람쥐같이 16/03/10 17:50 76 0
    63
    으아아ㅠㅠㅠ 트라인 너무 재미없어요 [3] 다람쥐같이 16/03/10 15:22 83 0
    각도 없이 회전하는 코드 왜 안돌아가는지 확인 가능하신 분 계시나요... [1] 다람쥐같이 15/10/18 16:03 27 0
    60
    영어 발음기호 [6] Handle레시피 15/07/02 11:32 19 0
    59
    '새끼'는 어느 정도의 욕설인가요? [2] Handle레시피 15/06/27 03:35 32 0
    58
    와 템플릿 미쳤네요 [6] Handle레시피 15/06/23 06:21 65 0
    57
    동생이 정신과 약물을 복용 중인데, 자다가 자주 소리치곤 해요 [4] Handle레시피 15/06/22 11:59 26 0
    56
    시작한지 얼마 안된 유전데 [3] 정명공주 15/06/15 04:34 109 0
    55
    디자인 패턴 말입니다. [5] 정명공주 15/06/08 17:47 45 0
    54
    리스크 오브 레인 세이브 있나요? [4] 정명공주 15/06/04 15:12 41 0
    53
    디자인 패턴 뭘로 공부하셨나요? [8] 정명공주 15/06/04 03:11 52 0
    52
    이 게임 이름 아시는분... [3] 정명공주 15/06/03 16:18 145 0
    51
    바닥에 한 쪽 무릎을 짚을 수가 없어요. [2] 정명공주 15/05/13 13:55 52 0
    50
    제가 오유를 그다지 오래 하지 않은 건지... [4] 정명공주 15/05/13 00:02 76 0
    49
    C++ 템플릿 [3] 사쿠라다네네 15/05/05 10:48 44 0
    48
    new 연산자의 시간 비용? [8] 사쿠라다네네 15/04/13 08:44 77 0
    47
    html 5는 웹 프로그래밍 언어 아니었나요? [16] 사쿠라다네네 15/04/08 09:13 116 0
    46
    [ㅄㄱ]구글갓에게 물어도 잘 모르겠네요... [25] 사쿠라다네네 15/04/08 06:02 119 0
    [1] [2] [3]
    단축키 운영진에게 바란다(삭제요청/제안) 운영게 게시판신청 자료창고 보류 개인정보취급방침 청소년보호정책 모바일홈