Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in astrojs.coordinates.ecliptic2azel #2

Open
PitWiener opened this issue Jul 31, 2019 · 0 comments
Open

error in astrojs.coordinates.ecliptic2azel #2

PitWiener opened this issue Jul 31, 2019 · 0 comments

Comments

@PitWiener
Copy link

PitWiener commented Jul 31, 2019

Hi!
I tried to use your astro.js lib but when I call
var sunazel = astrojs.coordinates.ecliptic2azel(sunpos.lat, sunpos.lon, lst, lat);
I get the error
SCRIPT438: Object doesn't support property or method 'vectorMultiply'
Did I something wrong? All parameters are numeric values!
Thanks
Peter


<!DOCTYPE html>
<html>

<!-- astro.js : http://slowe.github.io/astro.js/ -->

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<style type="text/css">

</style>

<script language="javascript" type="text/javascript" src="astro.js/astro.js"></script>
<script language="javascript" type="text/javascript" src="astro.js/astro.dates.js"></script> <!-- JD, GST, LST -->
<script language="javascript" type="text/javascript" src="astro.js/astro.ephem.js"></script> <!-- sunPos, moonPos -->
<script language="javascript" type="text/javascript" src="astro.js/astro.coords.js"></script> <!-- coordinates and value transformation -->
<script language="javascript" type="text/javascript" src="astro.js/astro.coordinates.js"></script> <!-- coordinates and value transformation -->
<script language="javascript" type="text/javascript">

var lng = 48.12;
var lat = -16.32;
var tz  = -1;

function initAstro() {
	//astrojs.ready(function(e){ });
	// ...
	doAstro();
	return;
}

function doAstro() {
	var txt = "";
	var dt = new Date();
	txt += dt + "<br>\n";
	var jd = astrojs.dates.getJulianDate(dt);
	txt += "Julian Date (JD) : " + jd + "<br>\n";
	txt += "Greenwich Sidereal Time (GST) : " + astrojs.dates.getGST(dt) + "<br>\n";
	var lst = astrojs.dates.getLST(dt, lng);
	txt += "Local Sidereal Time (LST) : " + lst + "<br>\n";
	var sunpos = astrojs.ephem.sunPos(jd);
	txt += "Sun Pos : lat:" + sunpos.lat + "  lon:" + sunpos.lon + "  Mo:" + sunpos.Mo + 
		"  D:" + sunpos.D + "  N:" + sunpos.N + "<br>\n";
	var sunazel = astrojs.coordinates.ecliptic2azel(sunpos.lat, sunpos.lon, lst, lat);   // <<<< ERROR
	txt += "Sun Pos : az:" + sunazel.az + "  el:" + sunazel.el + "<br>\n";
	var moonpos = astrojs.ephem.moonPos(jd, sunpos);
	txt += "Moon Pos : lat:" + moonpos.lat + "  lon:" + moonpos.lon + "<br>\n";
	txt += "mean Obliquity : " + astrojs.coordinates.meanObliquity(jd) + "<br>\n";

	document.getElementById("output").innerHTML = txt;
	return;
}


</script>

</head>

<body onload="initAstro()">

<form name="astro" action="#" onsubmit="doAstro();">
	<button onclick="doAstro();">submit</button>
</form>
<br><br>
Result:<br>
<p id="output">*</p>


</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant