电子邮件:flashindream[AT]gmail[DOT]com
略懂Flash的天文爱好者
PID的小故事
Post by indream, 2010-9-8, Views:小明接到这样一个任务:有一个水缸点漏水(而且漏水的速度还不一定固定不变),要求水面高度维持在某个位置,一旦发现水面高度低于要求位置,就要往水缸里加水。
小明接到任务后就一直守在水缸旁边,时间长就觉得无聊,就跑到房里看小说了,每30分钟来检查一次水面高度。水漏得太快,每次小明来检查时,水都快漏完了,离要求的高度相差很远,小明改为每3分钟来检查一次,结果每次来水都没怎么漏,不需要加水,来得太频繁做的是无用功。几次试验后,确定每10分钟来检查一次。这个检查时间就称为采样周期
开始小明用瓢加水,水龙头离水缸有十几米的距离,经常要跑好几趟才加够水,于是小明又改为用桶加,一加就是一桶,跑的次数少了,加水的速度也快了,但好几次将缸给加溢出了,不小心弄湿了几次鞋,小明又动脑筋,我不用瓢也不用桶,老子用盆,几次下来,发现刚刚好,不用跑太多次,也不会让水溢出。这个加水工具的大小就称为比例系数
小明又发现水虽然不会加过量溢出了,有时会高过要求位置比较多,还是有打湿鞋的危险。他又想了个办法,在水缸上装一个漏斗,每次加水不直接倒进水缸,而是倒进漏斗让它慢慢加。这样溢出的问题解决了,但加水的速度又慢了,有时还赶不上漏水的速度。于是他试着变换不同大小口径的漏斗来控制加水的速度,最后终于找到了满意的漏斗。漏斗的时间就称为积分时间
小明终于喘了一口,但任务的要求突然严了,水位控制的及时性要求大大提高,一旦水位过低,必须立即将水加到要求位置,而且不能高出太多,否则不给工钱。小明又为难了!于是他又开努脑筋,终于让它想到一个办法,常放一盆备用水在旁边,一发现水位低了,不经过漏斗就是一盆水下去,这样及时性是保证了,但水位有时会高多了。他又在要求水面位置上面一点将水凿一孔,再接一根管子到下面的备用桶里这样多出的水会从上面的孔里漏出来。这个水漏出的快慢就称为微分时间
Calculating Stellar Positions
Post by indream, 2010-8-27, Views:Coordinate translation
Now you're ready to calculate, for example, what the night sky from Sirius or Epsilon Eridani looks like. To do this, you'll need to know two things about the stars you'll be considering:
- Their positions
- Their brightnesses
Let's tackle the positions first.
Positions
Step 1: Get Cartesian coordinates for the stars
First, I'll introduce a little terminology that should help keep some ideas straight:
- Reference star: The star that you'll be "traveling to" and calculating the positions of other stars from. Its Cartesian coordinates are xR, yR and zR.
- Target Star: Any star you're looking at from the reference star. Its Cartesian coordinates are xT, yT, and zT.
- Transformed Target Coordinates: The coordinates of the target star as seen from the reference rather than from Earth. They are x'T, y'T, and z'T.
Suppose you're interested in figuring out what the night sky looks like from Barnard's Star, the second closest star to the Sun. The reference coordinates are therefore those of Barnard's Star, which has
= 17.9636 hours,
= 4.668 degrees, and d = 1.82 pc:
- xR = -0.017 pc
- yR = -1.815 pc
- zR = +0.148 pc
Let's figure out where Proxima Centauri would be. Its coordinates (from the Calculating Stellar Positions page) are:
- xT = -0.472 pc
- yT = -0.361 pc
- zt = -1.151 pc
Step 2: Figure out the transformed target coordinates
This is easier than it might seem! To find out the transformed target coordinates, as seen from the reference star, just subtract the reference's coordinates from the target's coordinates.
For Proxima Centauri:
- x'T = -0.472 - (-0.017) = -0.455 pc
- y'T = -0.361 - (-1.815) = +1.454 pc
- z't = -1.151 - (0.148) = -1.299 pc
Step 3: If desired, convert the transformed Cartesian
coordinates to spherical coordinates
The transformed target coordinates may be all you need if you have a computer program that'll plot the stars. If you want to draw star charts by hand, especially if you want to use common map projections, it will be useful to convert the Cartesian coordinates to something else.
The most useful transformation is to something called general spherical coordinates, which are very similar to equatorial coordinates. In fact, they're essentially identical -- the main reason for using them instead of equatorial coordinates is to avoid confusion between Earth-based measurements (which use the equatorial system) and calculations like these which apply far from
Earth. The spherical coordinates are:
- Azimuth

- Altitude

- Distance r
is like right ascension: it measures the angle around the Cartesian coordinate system, starting at the x-axis, as seen from the reference star.
is like declination: it measures the angle "up" or "down". r is the target star's distance from the reference.
To transform Cartesian coordinates to spherical coordinates:
- Calculate two distances:
- r = sqrt(x'T2 + y'T2 + z'T2)
- rxy = sqrt ( x'T2 +
y'T2)
- Apply two formulas:
= tan-1 (z'T / rxy);
= tan-1 (y'T / x'T)
This gives two angles similar to right ascension and declination (or, for that matter, longitude and latitude), which is what many map projections will call for. If you're using a computer rather than a hand calculator, the inverse tangent function will probably return a value in radians rather than degrees -- you may want to convert. You will use the distance r to get the star's brightness later.
Make sure the angle
is in the correct quadrant. If you are using the standard ATAN function on most calculators and computers,
will be calculated correctly only if x'T is positive. If it's negative, you'll generally have to add 180 degrees to the result to get the correct angle. Also, if x'T is positive and y'T is negative, ATAN will calculate a negative value for the angle; in that case, add 360 to bring it into the range 0 - 360 degrees. If you are using a calculator or a programming language with an ATAN2 function, use it instead:
= atan2 (y'T, x'T)
ATAN2 automatically puts the angle into the correct quadrant, in the range 0 - 360 degrees.
As an example: let's find the general spherical coordinates for Proxima Centauri as seen from Barnard's Star. Recall its transformed target coordinates:
- x'T = -0.472 - (-0.017) = -0.455 pc
- y'T = -0.361 - (-1.815) = +1.454 pc
- z't = -1.151 - (0.148) = -1.299 pc
- r = sqrt( (-0.455)2 + (1.454)2 + (-1.299)2)
- r = 2.002 pc.
- rxy = sqrt( (-0.455)2 + (1.454)2)
- rxy = 1.524 pc.
= tan-1 (-1.299 pc / 1.524 pc);
= -40.44 degrees.
= tan-1 (1.454 pc / -0.455 pc);
= -72.62 degrees.
Ugh. x'T is negative and the angle is outside the
usual range 0 - 360. Add 180 to bring
to the correct quadrant:
= 107.37 degrees.
Brightnesses
You now have the position of a star, in two different types of coordinates. The next step is the brightness.
Step 1: Get the distance to the target star from the
reference
If you calculated spherical coordinates, you have the distance, r, already. If not, calculate it:
- r = sqrt(x'T2 + y'T2 + z'T2)
Step 2: Find the star's apparent magnitude
As seen from Earth, a target star has an apparent magnitude, V. From a different reference star, the target star will have a different apparent magnitude, V'. Once you know the star's distance from the reference, r, as well as its distance from the Sun, d, you can use either of two formulas, depending on whether you know the target's apparent magnitude V (as seen from Earth), or its absolute magnitude MV:
- Earth-based apparent magnitude: V' = V - 5 log10 (d/r)
- Absolute magnitude: V' = MV - 5 log10 (10/r)
As an example, what is Proxima Centauri's apparent magnitude from Barnard's Star? From Earth, V = +11.01 and d = 1.29 pc, and the transformed coordinates of Proxima Centauri are:
- x'T = -0.472 - (-0.017) = -0.455 pc
- y'T = -0.361 - (-1.815) = +1.454 pc
- z't = -1.151 - (0.148) = -1.299 pc
- r = sqrt( (-0.455)2 + (1.454)2 +
(-1.299)2) - r = 2.002 pc.
- V' = +11.01 - 5 log10 (1.29/2.002)
- V' = +11.96
Proxima Centauri is dimmer than it is from Earth.
GB2312乱码问题的终极解决
Post by indream, 2010-8-17, Views:GB2312+非中文操作系统乱码问题的终极解决
var st:URLStream = new URLStream();
st.load(new URLRequest("list.xml"));
st.addEventListener(Event.COMPLETE,onCompleteXML);
function onCompleteXML(evt:Event):void{
var xml:XML = XML(st.readMultiByte(st.bytesAvailable,"gb2312"));
}
天荒坪测试之旅
Post by indream, 2010-8-16, Views:在天荒坪的三个夜晚测试自动导星,天气很理想,测试结果不理想.拍出的照片很多都有拉线,暗场也懒得拍.3天测试发现很多问题,整个系统的改善现在也有了目标
火焰星云&马头星云
礁湖星云&三叶星云
Ω星云
哑铃星云
猎户座大星云
昴星团
双星团
导星程序继续优化
Post by indream, 2010-8-5, Views:继续调整控制部分的代码,星点终于接近正圆了.
相机:canon 300D
主镜:80ED/560mm@iso100
导星镜:f=200mm@F3.3
曝光时间:600秒
中央100%:

缩略图:

结果不太理想
Post by indream, 2010-8-1, Views:图像插值走了不少弯路,虽然昨天就正确获得了插值后的图像(将8x8插值到44x44大小进行星点定位),导星的结果还是有较大拖线.今天反复调整控制命令,最后还是使用bang-bang控制获取到下图的结果.RA轴仍旧有拖线,实际是修正的来回摆动.
赤道仪:LXD75
控制器:Autostar
主镜:80ED/F7
导星镜:200mm/F3.3
曝光时间:600秒@ISO100(图像中部100%截取)

终于上ED了
Post by indream, 2010-6-30, Views:
收了一支二手英田80ED,终于配齐了一套全二手班.
06/26月偏食
Post by indream, 2010-6-27, Views:将基于AVM1Movie的SWF编码成AS3的MovieClip类
Post by indream, 2010-6-18, Views:/*
* ForcibleLoader
*
* Licensed under the MIT License
*
* Copyright (c) 2007-2009 BeInteractive! (www.be-interactive.org) and
* Spark project (www.libspark.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
package
{
import flash.display.Loader;
import flash.net.URLRequest;
import flash.net.URLStream;
import flash.events.IOErrorEvent;
import flash.events.SecurityErrorEvent;
import flash.events.Event;
import flash.utils.ByteArray;
import flash.utils.Endian;
import flash.errors.EOFError;
/**
* Loads a SWF file as version 9 format forcibly even if version is under 9.
*
* Usage:
* <pre>
* var loader:Loader = Loader(addChild(new Loader()));
* var fLoader:ForcibleLoader = new ForcibleLoader(loader);
* fLoader.load(new URLRequest('swf7.swf'));
* </pre>
*
* @author yossy:beinteractive
* @see http://www.be-interactive.org/?itemid=250
* @see http://fladdict.net/blog/2007/05/avm2avm1swf.html
*/
public class ForcibleLoader
{
public function ForcibleLoader(loader:Loader)
{
this.loader = loader;
_stream = new URLStream();
_stream.addEventListener(Event.COMPLETE, completeHandler);
_stream.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
_stream.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
}
private var _loader:Loader;
private var _stream:URLStream;
public function get loader():Loader
{
return _loader;
}
public function set loader(value:Loader):void
{
_loader = value;
}
public function load(request:URLRequest):void
{
_stream.load(request);
}
private function completeHandler(event:Event):void
{
var inputBytes:ByteArray = new ByteArray();
_stream.readBytes(inputBytes);
_stream.close();
inputBytes.endian = Endian.LITTLE_ENDIAN;
if (isCompressed(inputBytes)) {
uncompress(inputBytes);
}
var version:uint = uint(inputBytes[3]);
if (version < 9) {
updateVersion(inputBytes, 9);
}
if (version > 7) {
flagSWF9Bit(inputBytes);
}
else {
insertFileAttributesTag(inputBytes);
}
loader.loadBytes(inputBytes);
}
private function isCompressed(bytes:ByteArray):Boolean
{
return bytes[0] == 0x43;
}
private function uncompress(bytes:ByteArray):void
{
var cBytes:ByteArray = new ByteArray();
cBytes.writeBytes(bytes, 8);
bytes.length = 8;
bytes.position = 8;
cBytes.uncompress();
bytes.writeBytes(cBytes);
bytes[0] = 0x46;
cBytes.length = 0;
}
private function getBodyPosition(bytes:ByteArray):uint
{
var result:uint = 0;
result += 3; // FWS/CWS
result += 1; // version(byte)
result += 4; // length(32bit-uint)
var rectNBits:uint = bytes[result] >>> 3;
result += (5 + rectNBits * 4) / 8; // stage(rect)
result += 2;
result += 1; // frameRate(byte)
result += 2; // totalFrames(16bit-uint)
return result;
}
private function findFileAttributesPosition(offset:uint, bytes:ByteArray):uint
{
bytes.position = offset;
try {
for (;;) {
var byte:uint = bytes.readShort();
var tag:uint = byte >>> 6;
if (tag == 69) {
return bytes.position - 2;
}
var length:uint = byte & 0x3f;
if (length == 0x3f) {
length = bytes.readInt();
}
bytes.position += length;
}
}
catch (e:EOFError) {
}
return NaN;
}
private function flagSWF9Bit(bytes:ByteArray):void
{
var pos:uint = findFileAttributesPosition(getBodyPosition(bytes), bytes);
if (!isNaN(pos)) {
bytes[pos + 2] |= 0x08;
}
}
private function insertFileAttributesTag(bytes:ByteArray):void
{
var pos:uint = getBodyPosition(bytes);
var afterBytes:ByteArray = new ByteArray();
afterBytes.writeBytes(bytes, pos);
bytes.length = pos;
bytes.position = pos;
bytes.writeByte(0x44);
bytes.writeByte(0x11);
bytes.writeByte(0x08);
bytes.writeByte(0x00);
bytes.writeByte(0x00);
bytes.writeByte(0x00);
bytes.writeBytes(afterBytes);
afterBytes.length = 0;
}
private function updateVersion(bytes:ByteArray, version:uint):void
{
bytes[3] = version;
}
private function ioErrorHandler(event:IOErrorEvent):void
{
loader.contentLoaderInfo.dispatchEvent(event.clone());
}
private function securityErrorHandler(event:SecurityErrorEvent):void
{
loader.contentLoaderInfo.dispatchEvent(event.clone());
}
}
}
ARM导星系统摆拍
Post by indream, 2010-6-10, Views:嘿嘿

Hot Articles
Friend Connect
New Articles
- [09/08]PID的小故事
- [08/27]Calculating Stellar Positions
- [08/17]GB2312乱码问题的终极解决
- [08/16]天荒坪测试之旅
- [08/05]导星程序继续优化
- [08/01]结果不太理想
- [06/30]终于上ED了
- [06/27]06/26月偏食
- [06/18]将基于AVM1Movie的SWF编码成AS3的MovieClip类
- [06/10]ARM导星系统摆拍
- [06/06]ARM导星系统开发笔记(二)
- [06/04]ARM导星系统开发笔记(一)
- [06/03]开发基于ARM(CORTEX M3)自动导星系统
- [05/27]跳啊,跳吧
- [05/23]汉字转拼音_AS3
Archives
- 2010 September (1)
- 2010 August (5)
- 2010 June (7)
- 2010 May (10)
- 2010 April (2)
- 2010 March (4)
- 2010 February (3)
- 2010 January (3)
- 2009 December (2)
- 2009 November (7)
- 2009 October (8)
- 2009 September (6)
- 2009 August (11)
- 2009 July (9)
- 2009 June (2)
- 2009 May (9)
- 2009 April (8)
- 2009 March (6)
- 2009 January (2)
- 2008 December (6)
- 2008 November (4)
- 2008 October (1)
- 2008 August (3)
- 2008 July (2)
- 2008 June (9)
- 2008 May (8)
- 2008 April (20)
- 2008 March (4)
- 2008 January (1)
- 2007 December (3)
- 2007 November (7)
- 2007 October (6)
- 2007 September (1)
- 2007 August (10)
- 2007 July (11)
- 2007 June (5)
- 2007 April (4)
- 2007 March (10)
- 2007 February (4)
- 2007 January (10)
- 2006 December (17)
- 2006 November (11)
- 2006 October (6)
- 2006 September (19)
- 2006 August (22)
Favorite
Links
Statistics
- 文章总数:313
- 评论总数:194
- 引用总数:0
- 浏览总数:2000
- 留言总数:1
- 当前主题:sean
- 当前样式:Sean_Sim
