-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8345ebe
commit 848a180
Showing
7 changed files
with
192 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
*! shapes v1.0 (11 Oct 2024) | ||
*! Asjad Naqvi (asjadnaqvi@gmail.com) | ||
|
||
* v1.0 (11 Oct 2024): first release. | ||
|
||
|
||
cap program drop shapes | ||
|
||
program define shapes | ||
|
||
version 11 | ||
gettoken left 0: 0, parse(", ") | ||
|
||
if "`left'" == "circle" { | ||
_circle `0' | ||
} | ||
|
||
end | ||
|
||
|
||
|
||
program define _circle | ||
version 11 | ||
|
||
syntax [, n(real 6) ROtate(real 0) RADius(real 10) ] | ||
|
||
|
||
quietly { | ||
if _N < `n' set obs `n' | ||
|
||
local rotate = `rotate' * _pi / 180 | ||
|
||
tempvar _seq _angle | ||
|
||
gen `_seq' = _n | ||
gen double `_angle' = (`_seq' * 2 * _pi / `n') + `rotate' | ||
|
||
gen double _x = `radius' * cos(`_angle') | ||
gen double _y = `radius' * sin(`_angle') | ||
|
||
|
||
expand 2 if `_seq'== 1 | ||
set obs `=_N+1' // pad a row in case more rows are added. | ||
gen _id = _n | ||
|
||
order _id | ||
} | ||
|
||
|
||
end | ||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.