diff --git a/astro_functions.php b/astro_functions.php
new file mode 100644
index 0000000..2b5f588
--- /dev/null
+++ b/astro_functions.php
@@ -0,0 +1,118 @@
+ $planetKey,
+ 'name' => getPlanetName($planetKey, $mode),
+ 'short' => getPlanetShortName($planetKey),
+ 'house' => $segment,
+ 'longitude' => normalizeLongitude($longitude),
+ 'sign_key' => $signKey,
+ 'sign' => getSignName($signKey, $mode),
+ 'degree_value' => $degreeWithinSign,
+ 'degree' => formatDegree($degreeWithinSign),
+ 'nakshatra_key' => $nakshatraKey,
+ 'nakshatra' => getNakshatraName($nakshatraKey, $mode)
+ ];
+}
+
+function sortPlanetsByLongitude(array $planets): array
+{
+ usort($planets, function ($a, $b) {
+ return ($a['longitude'] ?? 0) <=> ($b['longitude'] ?? 0);
+ });
+
+ return $planets;
+}
\ No newline at end of file
diff --git a/constants.php b/constants.php
new file mode 100644
index 0000000..059e07c
--- /dev/null
+++ b/constants.php
@@ -0,0 +1,202 @@
+ [
+ 'sun' => 'Sun',
+ 'moon' => 'Moon',
+ 'mercury' => 'Mercury',
+ 'venus' => 'Venus',
+ 'mars' => 'Mars',
+ 'jupiter' => 'Jupiter',
+ 'saturn' => 'Saturn',
+ 'rahu' => 'Rahu',
+ 'ketu' => 'Ketu'
+ ],
+ 'vedic' => [
+ 'sun' => 'Surya',
+ 'moon' => 'Chandra',
+ 'mercury' => 'Budha',
+ 'venus' => 'Shukra',
+ 'mars' => 'Mangala',
+ 'jupiter' => 'Guru',
+ 'saturn' => 'Shani',
+ 'rahu' => 'Rahu',
+ 'ketu' => 'Ketu'
+ ]
+];
+
+const PLANET_SHORT_NAMES = [
+ 'sun' => 'Su',
+ 'moon' => 'Mo',
+ 'mercury' => 'Me',
+ 'venus' => 'Ve',
+ 'mars' => 'Ma',
+ 'jupiter' => 'Ju',
+ 'saturn' => 'Sa',
+ 'rahu' => 'Ra',
+ 'ketu' => 'Ke'
+];
+
+// ----------------------------
+// SIGNS
+// ----------------------------
+const SIGN_KEYS = [
+ 'aries',
+ 'taurus',
+ 'gemini',
+ 'cancer',
+ 'leo',
+ 'virgo',
+ 'libra',
+ 'scorpio',
+ 'sagittarius',
+ 'capricorn',
+ 'aquarius',
+ 'pisces'
+];
+
+const SIGN_NAMES = [
+ 'modern' => [
+ 'aries' => 'Aries',
+ 'taurus' => 'Taurus',
+ 'gemini' => 'Gemini',
+ 'cancer' => 'Cancer',
+ 'leo' => 'Leo',
+ 'virgo' => 'Virgo',
+ 'libra' => 'Libra',
+ 'scorpio' => 'Scorpio',
+ 'sagittarius' => 'Sagittarius',
+ 'capricorn' => 'Capricorn',
+ 'aquarius' => 'Aquarius',
+ 'pisces' => 'Pisces'
+ ],
+ 'vedic' => [
+ 'aries' => 'Mesha',
+ 'taurus' => 'Vrishabha',
+ 'gemini' => 'Mithuna',
+ 'cancer' => 'Karka',
+ 'leo' => 'Simha',
+ 'virgo' => 'Kanya',
+ 'libra' => 'Tula',
+ 'scorpio' => 'Vrischika',
+ 'sagittarius' => 'Dhanu',
+ 'capricorn' => 'Makara',
+ 'aquarius' => 'Kumbha',
+ 'pisces' => 'Meena'
+ ]
+];
+
+// ----------------------------
+// NAKSHATRAS
+// ----------------------------
+const NAKSHATRA_KEYS = [
+ 'ashwini',
+ 'bharani',
+ 'krittika',
+ 'rohini',
+ 'mrigashira',
+ 'ardra',
+ 'punarvasu',
+ 'pushya',
+ 'ashlesha',
+ 'magha',
+ 'purva_phalguni',
+ 'uttara_phalguni',
+ 'hasta',
+ 'chitra',
+ 'swati',
+ 'vishakha',
+ 'anuradha',
+ 'jyeshtha',
+ 'mula',
+ 'purva_ashadha',
+ 'uttara_ashadha',
+ 'shravana',
+ 'dhanishta',
+ 'shatabhisha',
+ 'purva_bhadrapada',
+ 'uttara_bhadrapada',
+ 'revati'
+];
+
+const NAKSHATRA_NAMES = [
+ 'modern' => [
+ 'ashwini' => 'Ashwini',
+ 'bharani' => 'Bharani',
+ 'krittika' => 'Krittika',
+ 'rohini' => 'Rohini',
+ 'mrigashira' => 'Mrigashira',
+ 'ardra' => 'Ardra',
+ 'punarvasu' => 'Punarvasu',
+ 'pushya' => 'Pushya',
+ 'ashlesha' => 'Ashlesha',
+ 'magha' => 'Magha',
+ 'purva_phalguni' => 'Purva Phalguni',
+ 'uttara_phalguni' => 'Uttara Phalguni',
+ 'hasta' => 'Hasta',
+ 'chitra' => 'Chitra',
+ 'swati' => 'Swati',
+ 'vishakha' => 'Vishakha',
+ 'anuradha' => 'Anuradha',
+ 'jyeshtha' => 'Jyeshtha',
+ 'mula' => 'Mula',
+ 'purva_ashadha' => 'Purva Ashadha',
+ 'uttara_ashadha' => 'Uttara Ashadha',
+ 'shravana' => 'Shravana',
+ 'dhanishta' => 'Dhanishta',
+ 'shatabhisha' => 'Shatabhisha',
+ 'purva_bhadrapada' => 'Purva Bhadrapada',
+ 'uttara_bhadrapada'=> 'Uttara Bhadrapada',
+ 'revati' => 'Revati'
+ ],
+ 'vedic' => [
+ 'ashwini' => 'Ashwini',
+ 'bharani' => 'Bharani',
+ 'krittika' => 'Krittika',
+ 'rohini' => 'Rohini',
+ 'mrigashira' => 'Mrigashira',
+ 'ardra' => 'Ardra',
+ 'punarvasu' => 'Punarvasu',
+ 'pushya' => 'Pushya',
+ 'ashlesha' => 'Ashlesha',
+ 'magha' => 'Magha',
+ 'purva_phalguni' => 'Purva Phalguni',
+ 'uttara_phalguni' => 'Uttara Phalguni',
+ 'hasta' => 'Hasta',
+ 'chitra' => 'Chitra',
+ 'swati' => 'Swati',
+ 'vishakha' => 'Vishakha',
+ 'anuradha' => 'Anuradha',
+ 'jyeshtha' => 'Jyeshtha',
+ 'mula' => 'Mula',
+ 'purva_ashadha' => 'Purva Ashadha',
+ 'uttara_ashadha' => 'Uttara Ashadha',
+ 'shravana' => 'Shravana',
+ 'dhanishta' => 'Dhanishta',
+ 'shatabhisha' => 'Shatabhisha',
+ 'purva_bhadrapada' => 'Purva Bhadrapada',
+ 'uttara_bhadrapada'=> 'Uttara Bhadrapada',
+ 'revati' => 'Revati'
+ ]
+];
\ No newline at end of file
diff --git a/css.css b/css.css
index f4762c0..d3f1247 100644
--- a/css.css
+++ b/css.css
@@ -27,15 +27,16 @@
margin-top: 20px;
}
- .astro-circle {
- position: relative;
- width: 520px;
- height: 520px;
- border-radius: 50%;
- border: 4px solid #facc15;
- background: radial-gradient(circle, #1e293b 40%, #0f172a 100%);
- overflow: hidden;
- }
+.astro-circle {
+ position: relative;
+ width: 520px;
+ height: 520px;
+ border-radius: 50%;
+ border: 4px solid #facc15;
+ background: radial-gradient(circle, #1e293b 40%, #0f172a 100%);
+ overflow: visible;
+ margin: 40px;
+}
.segment-line {
position: absolute;
@@ -139,14 +140,77 @@
padding: 3px 6px;
}
}
- .segment-label{
-position:absolute;
-font-weight:bold;
-font-size:18px;
-color:#facc15;
-transform:translate(-50%,-50%);
-background:rgba(0,0,0,0.35);
-padding:6px 10px;
-border-radius:6px;
-border:1px solid rgba(255,255,255,0.2);
+
+.result-box{
+ margin-top: 15px;
+ padding: 15px 18px;
+ border-radius: 12px;
+ background: rgba(255,255,255,0.06);
+ border: 1px solid rgba(255,255,255,0.08);
+ color: #fff;
}
+
+.result-box p{
+ margin-bottom: 8px;
+}
+.planet-tag{
+ position:absolute;
+ transform:translate(-50%,-50%);
+ background:rgba(250, 204, 21, 0.18);
+ color:#ffffff;
+ border:1px solid rgba(250, 204, 21, 0.55);
+ border-radius:8px;
+ padding:4px 8px;
+ font-size:13px;
+ font-weight:700;
+ line-height:1;
+ white-space:nowrap;
+ box-shadow:0 4px 10px rgba(0,0,0,0.2);
+}
+.table-box{
+ background: rgba(255,255,255,0.05);
+ border: 1px solid rgba(255,255,255,0.08);
+ border-radius: 14px;
+ padding: 18px;
+}
+
+.table-title{
+ color: #facc15;
+ font-weight: 700;
+ margin-bottom: 15px;
+}
+
+.astro-table{
+ background: transparent;
+ color: #fff;
+}
+
+.astro-table thead th{
+ background: rgba(250, 204, 21, 0.15);
+ color: #facc15;
+ border-color: rgba(255,255,255,0.12);
+}
+
+.astro-table td,
+.astro-table th{
+ border-color: rgba(255,255,255,0.12);
+ background: rgba(255,255,255,0.03);
+}
+
+.astro-table tbody tr:hover td{
+ background: rgba(255,255,255,0.07);
+}
+.sign-label{
+ position:absolute;
+ transform:translate(-50%,-50%);
+ color:#cbd5e1;
+ font-size:12px;
+ font-weight:700;
+ line-height:1.1;
+ text-align:center;
+ white-space:nowrap;
+ background:rgba(15, 23, 42, 0.55);
+ padding:3px 6px;
+ border-radius:6px;
+ border:1px solid rgba(255,255,255,0.08);
+}
\ No newline at end of file
diff --git a/index.php b/index.php
index adcaa36..109af68 100644
--- a/index.php
+++ b/index.php
@@ -1,3 +1,109 @@
+ ['latitude' => 27.7172, 'longitude' => 85.3240],
+ 'Pokhara' => ['latitude' => 28.2096, 'longitude' => 83.9856],
+ 'Lalitpur' => ['latitude' => 27.6644, 'longitude' => 85.3188],
+ 'Bhaktapur' => ['latitude' => 27.6710, 'longitude' => 85.4298],
+ 'Biratnagar' => ['latitude' => 26.4525, 'longitude' => 87.2718],
+ 'Chitwan' => ['latitude' => 27.5291, 'longitude' => 84.3542],
+ 'Butwal' => ['latitude' => 27.7000, 'longitude' => 83.4480]
+];
+
+$latitude = '';
+$longitude = '';
+
+$localDateTime = '';
+$utcDateTime = '';
+$unixTimestamp = '';
+$julianDay = '';
+$decimalHour = '';
+
+if (!empty($location) && isset($locationMap[$location])) {
+ $latitude = $locationMap[$location]['latitude'];
+ $longitude = $locationMap[$location]['longitude'];
+}
+
+function getJulianDayFromDateTime($date, $time, $timezone = 'Asia/Kathmandu')
+{
+ $dt = new DateTime("$date $time", new DateTimeZone($timezone));
+ $dtUtc = clone $dt;
+ $dtUtc->setTimezone(new DateTimeZone('UTC'));
+
+ $year = (int)$dtUtc->format('Y');
+ $month = (int)$dtUtc->format('m');
+ $day = (int)$dtUtc->format('d');
+ $hour = (int)$dtUtc->format('H');
+ $minute = (int)$dtUtc->format('i');
+ $second = (int)$dtUtc->format('s');
+
+ $decimalHour = $hour + ($minute / 60) + ($second / 3600);
+
+ if ($month <= 2) {
+ $year -= 1;
+ $month += 12;
+ }
+
+ $A = floor($year / 100);
+ $B = 2 - $A + floor($A / 4);
+
+ $jd = floor(365.25 * ($year + 4716))
+ + floor(30.6001 * ($month + 1))
+ + $day + $B - 1524.5
+ + ($decimalHour / 24);
+
+ return [
+ 'local_datetime' => $dt->format('Y-m-d H:i:s'),
+ 'utc_datetime' => $dtUtc->format('Y-m-d H:i:s'),
+ 'unix_timestamp' => $dt->getTimestamp(),
+ 'julian_day' => round($jd, 6),
+ 'decimal_hour' => round($decimalHour, 6)
+ ];
+}
+
+if (!empty($date) && !empty($time) && !empty($location) && isset($locationMap[$location])) {
+ $calcData = getJulianDayFromDateTime($date, $time);
+
+ $localDateTime = $calcData['local_datetime'];
+ $utcDateTime = $calcData['utc_datetime'];
+ $unixTimestamp = $calcData['unix_timestamp'];
+ $julianDay = $calcData['julian_day'];
+ $decimalHour = $calcData['decimal_hour'];
+}
+
+/*
+ SAMPLE PLANET DATA
+ house = wheel segment number
+*/
+$samplePlanets = [
+ buildPlanetDataFromLongitude('sun', 5.20, 1, $nameMode),
+ buildPlanetDataFromLongitude('moon', 72.13, 3, $nameMode),
+ buildPlanetDataFromLongitude('mars', 78.35, 3, $nameMode),
+ buildPlanetDataFromLongitude('mercury', 32.08, 2, $nameMode),
+ buildPlanetDataFromLongitude('venus', 41.30, 2, $nameMode),
+ buildPlanetDataFromLongitude('jupiter', 129.18, 5, $nameMode),
+ buildPlanetDataFromLongitude('saturn', 22.43, 1, $nameMode),
+ buildPlanetDataFromLongitude('rahu', 304.23, 11, $nameMode),
+ buildPlanetDataFromLongitude('ketu', 124.23, 7, $nameMode)
+];
+
+$planetsByHierarchy = $samplePlanets;
+$positionsInOrder = sortPlanetsByLongitude($samplePlanets);
+
+usort($positionsInOrder, function ($a, $b) {
+ return $a['house'] <=> $b['house'];
+});
+?>
@@ -8,13 +114,11 @@
-
-
Prajwal's Astro Analysis
@@ -23,74 +127,166 @@
-
-
+
+
+
+
Geocentric Positioning of Planets
-
+
+
+
+
+
Date: = htmlspecialchars($date ?: '-') ?>
+
Time: = htmlspecialchars($time ?: '-') ?>
+
Location: = htmlspecialchars($location ?: '-') ?>
+
Latitude: = $latitude !== '' ? htmlspecialchars((string)$latitude) : '-' ?>
+
Longitude: = $longitude !== '' ? htmlspecialchars((string)$longitude) : '-' ?>
+
+
+
Local DateTime: = $localDateTime ?: '-' ?>
+
UTC DateTime: = $utcDateTime ?: '-' ?>
+
Unix Timestamp: = $unixTimestamp !== '' ? $unixTimestamp : '-' ?>
+
Decimal Hour (UTC): = $decimalHour !== '' ? $decimalHour : '-' ?>
+
Julian Day: = $julianDay !== '' ? $julianDay : '-' ?>
+
+
-
- Geocentric Positioning of Planets, Nakshatra, and Horoscope
+
+
+
+
+
+
Please select date, time, and location, then click Analyze.
+
+
-
-
-

+
+
+
+
+
+
+
Table 1: Positions by Planets
+
+
+
+
+ | Planet |
+ Segment |
+ Sign |
+ Degree |
+ Nakshatra |
+
+
+
+
+
+
+
+
+ | = htmlspecialchars($planet['name']) ?> |
+ = htmlspecialchars($planet['house']) ?> |
+ = htmlspecialchars($planet['sign']) ?> |
+ = htmlspecialchars($planet['degree']) ?> |
+ = htmlspecialchars($planet['nakshatra']) ?> |
+
+
+
+
+
+
+
+
+
+
+
Table 2: Positions in Order
+
+
+
+
+
+ | Segment |
+ Planet |
+ Sign |
+ Degree |
+ Nakshatra |
+
+
+
+
+
+
+
+
+ | = htmlspecialchars($planet['house']) ?> |
+ = htmlspecialchars($planet['name']) ?> |
+ = htmlspecialchars($planet['sign']) ?> |
+ = htmlspecialchars($planet['degree']) ?> |
+ = htmlspecialchars($planet['nakshatra']) ?> |
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
diff --git a/js.js b/js.js
index 9828f0d..3daa9f6 100644
--- a/js.js
+++ b/js.js
@@ -1,47 +1,91 @@
-document.addEventListener("DOMContentLoaded", function() {
+document.addEventListener("DOMContentLoaded", function () {
+ const astroCircle = document.getElementById("astroCircle");
- const astroCircle = document.getElementById("astroCircle");
+ const segmentNumbers = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
- const labels = [
- "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"
- ];
- const circleSize = astroCircle.offsetWidth;
- const centerX = circleSize / 2;
- const centerY = circleSize / 2;
+ const circleSize = astroCircle.offsetWidth;
+ const centerX = circleSize / 2;
+ const centerY = circleSize / 2;
+ const radius = circleSize / 2;
- const radius = circleSize / 2;
+ const numberRadius = radius + (circleSize < 400 ? 18 : 28);
+ const signRadius = radius * 0.84;
+ const planetRadius = radius * 0.66;
- // numbers will be placed OUTSIDE the circle
- const numberRadius = radius + 25;
+ for (let i = 0; i < 12; i++) {
+ const angleDeg = i * 30;
- for (let i = 0; i < 12; i++) {
+ // segment divider
+ const line = document.createElement("div");
+ line.classList.add("segment-line");
+ line.style.transform = `translateX(-50%) rotate(${angleDeg}deg)`;
+ astroCircle.appendChild(line);
- const angleDeg = i * 30;
- const angleRad = (angleDeg - 90) * Math.PI / 180;
+ // middle of segment
+ const midAngle = angleDeg + 15;
+ const midRad = (midAngle - 90) * Math.PI / 180;
- // draw segment divider
- const line = document.createElement("div");
- line.classList.add("segment-line");
- line.style.transform = `translateX(-50%) rotate(${angleDeg}deg)`;
- astroCircle.appendChild(line);
+ // outside segment number
+ const numberX = centerX + numberRadius * Math.cos(midRad);
+ const numberY = centerY + numberRadius * Math.sin(midRad);
- // place number in center of segment
- const midAngle = angleDeg + 15;
- const midRad = (midAngle - 90) * Math.PI / 180;
+ const number = document.createElement("div");
+ number.classList.add("segment-number");
+ number.innerText = segmentNumbers[i];
+ number.style.left = `${numberX}px`;
+ number.style.top = `${numberY}px`;
+ astroCircle.appendChild(number);
- const x = centerX + numberRadius * Math.cos(midRad);
- const y = centerY + numberRadius * Math.sin(midRad);
+ // inside sign label
+ const signX = centerX + signRadius * Math.cos(midRad);
+ const signY = centerY + signRadius * Math.sin(midRad);
- const number = document.createElement("div");
- number.classList.add("segment-number");
- number.innerText = labels[i];
+ const sign = document.createElement("div");
+ sign.classList.add("sign-label");
+ sign.innerText = signNames[i];
+ sign.style.left = `${signX}px`;
+ sign.style.top = `${signY}px`;
+ astroCircle.appendChild(sign);
+ }
- number.style.left = `${x}px`;
- number.style.top = `${y}px`;
+ if (typeof samplePlanets !== "undefined" && Array.isArray(samplePlanets)) {
+ placeSamplePlanets(astroCircle, samplePlanets, centerX, centerY, planetRadius);
+ }
+});
- astroCircle.appendChild(number);
+function placeSamplePlanets(astroCircle, planets, centerX, centerY, planetRadius) {
+ const groupedByHouse = {};
- }
+ planets.forEach(planet => {
+ if (!groupedByHouse[planet.house]) {
+ groupedByHouse[planet.house] = [];
+ }
+ groupedByHouse[planet.house].push(planet);
+ });
- });
\ No newline at end of file
+ Object.keys(groupedByHouse).forEach(houseKey => {
+ const houseNumber = parseInt(houseKey, 10);
+ const housePlanets = groupedByHouse[houseNumber];
+
+ const segmentStartAngle = (houseNumber - 1) * 30;
+ const segmentMidAngle = segmentStartAngle + 15;
+ const segmentMidRad = (segmentMidAngle - 90) * Math.PI / 180;
+
+ const baseX = centerX + planetRadius * Math.cos(segmentMidRad);
+ const baseY = centerY + planetRadius * Math.sin(segmentMidRad);
+
+ housePlanets.forEach((planet, index) => {
+ const planetEl = document.createElement("div");
+ planetEl.classList.add("planet-tag");
+ planetEl.innerText = planet.short;
+ planetEl.title = planet.name + " | Segment " + planet.house + " | " + planet.sign;
+
+ const verticalOffset = index * 24;
+ planetEl.style.left = `${baseX}px`;
+ planetEl.style.top = `${baseY + verticalOffset}px`;
+
+ astroCircle.appendChild(planetEl);
+ });
+ });
+}
\ No newline at end of file