≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Draw Line - 3d
Posted by:
(you are not logged in)
Enter the missing letter in: "Interna?ional"
(you are not logged in)
Text:
[quote][b]SamGrady[/b] wrote: If you need function for draw line (cuz coppercube hasn't own one) i created this one for own use (based on one of my previous answer about Pythagoras theorem), use it after transform 3d position into 2d. Not sure about perfomance [code] function line(x1,y1,x2,y2){ for(i = 0; i < fDst(x1,y1,x2,y2); ++i){ var x = x1 + Math.sin(fAng(x1,y1,x2,y2)/57.29)*i; var y = y1 + Math.cos(fAng(x1,y1,x2,y2)/57.29)*i; ccbDrawColoredRectangle(0x79ffffff,x-0.5,y-0.5,x+0.5,y+0.5); } } function fAng(x1,y1,x2,y2){ if((y2 - y1) < 0) return (Math.atan((x2 - x1) / (y2 - y1)) + Math.PI) * 57.29; else return Math.atan((x2 - x1) / (y2 - y1)) * 57.29; } function fDst(x1,y1,x2,y2){ return Math.sqrt(((x2 - x1)*(x2 - x1))+((y2 - y1)*(y2 - y1))); } [/code][/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact