Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 511121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:11:03+00:00 2026-05-13T07:11:03+00:00

I am trying to create an Aitoff-Hammer grid in Silverlight using C#. It should

  • 0

I am trying to create an Aitoff-Hammer grid in Silverlight using C#. It should look like this minus the dots and numbers.

I am not a programmer but have been able to piece together this using an ActionScript file to do the same thing that was written by my predecessor.
As you can see, I get the grid plus unwanted diagonal lines. I am not sure how to avoid having the diagonal lines from being drawn in my code.

Any help anyone can provide to fix my problem or point out what I may be doing wrong will be much appreciated. Please let me know if I left out important information. Thanks.

Here is my code:

PolyLineSegment segment = new PolyLineSegment();

PathFigure figure = new PathFigure();

figure.StartPoint = new Point(xCenter, yCenter);

PathGeometry geometry = new PathGeometry();

Path path = new Path();

path.Stroke = new SolidColorBrush(Colors.Black);

path.StrokeThickness = 2;
aitoff coords = new aitoff(); 

for (int ra = 0; ra <= 24; ra = ra + 3)
{
    for (int dec = -90; dec <= 90; dec = dec + 3)
    {
        points = coords.GetAitoffCoord(ra, dec);
        double xCoord = xCenter + points.X * width / 2;
        double yCoord = yCenter + points.Y * height / 2;
        segment.Points.Add(new Point(xCoord, yCoord));                  
    }
}      

for (int dec = -90; dec <= 90; dec = dec + 30)
{
    for (int ra = 0; ra <= 12; ra = ra + 1)
    {
        points = coords.GetAitoffCoord(ra, dec);
        double xCoord = xCenter + points.X * width / 2;
        double yCoord = yCenter + points.Y * height / 2;                  
        segment.Points.Add(new Point(xCoord, yCoord));
    }
}

for (int dec = -90; dec <= 90; dec = dec + 30)
{
    for (double ra = 12.01; ra <= 25; ra++)
    {
        points = coords.GetAitoffCoord(ra, dec);
        double xCoord = xCenter + points.X * width / 2;
        double yCoord = yCenter + points.Y * height / 2;
        segment.Points.Add(new Point(xCoord, yCoord));
    }
}

for (int dec = -90; dec <= 90; dec = dec + 3)
{
    double ra = 12.01;

    points = coords.GetAitoffCoord(ra, dec);
    double xCoord = xCenter + points.X * width / 2;
    double yCoord = yCenter + points.Y * height / 2;
    segment.Points.Add(new Point(xCoord, yCoord));
}

figure.Segments.Add(segment);
geometry.Figures.Add(figure);
path.Data = geometry;
LayoutRoot.Children.Add(path);


// GetAitoff

public class aitoff
{
    double ra;
    double dec;

    Point coords = new Point();

    double ra2deg = Math.PI / 180.0f;

    public Point GetAitoffCoord(double raIn, double decIn)
    {
        ra = raIn * 360 / 24;
        dec = decIn;
        if (ra > 180)
           ra = ra - 360;

        double l = ra * ra2deg;
        double b = dec * ra2deg;

        double t = Math.Sqrt(2 / (1 + Math.Cos(b) * Math.Cos(l / 2)));
        double x = 2 * t * Math.Cos(b) * Math.Sin(l / 2);
        double y = t * Math.Sin(b);

        coords.X = x / (-2 * Math.Sqrt(2));
        coords.Y = y / (-1 * Math.Sqrt(2));

        return coords;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:11:03+00:00Added an answer on May 13, 2026 at 7:11 am

    The diagonal superfluous lines are there because you are adding points and segments to the same figure. The pen never gets lifted from the paper. You have to split your geometry into more figures.

    Copy your segment and figures creating into every place you want the pen to “go down”, and the figure.Segments.Add(segment) and geometry.Figures.Add(figure) into every place you want the pen to “go up”.

    That way your geometry will consist of many separate figures, and your diagonals should no longer be a problem.

            for (int ra = 0; ra <= 24; ra = ra + 3)
            {
                figure = new PathFigure();
                segment = new PolyLineSegment();
                for (int dec = -90; dec <= 90; dec = dec + 3)    
                {        
                    points = coords.GetAitoffCoord(ra, dec);        
                    double xCoord = xCenter + points.X * width / 2;        
                    double yCoord = yCenter + points.Y * height / 2;        
                    segment.Points.Add(new Point(xCoord, yCoord));                      
                }
                figure.StartPoint = segment.Points[0];
                figure.Segments.Add(segment);
                geometry.Figures.Add(figure);
            }
    
            for (int dec = -90; dec <= 90; dec = dec + 30)
            {
                figure = new PathFigure();
                segment = new PolyLineSegment();
                for (int ra = 0; ra <= 12; ra = ra + 1)
                {
                    points = coords.GetAitoffCoord(ra, dec);
                    double xCoord = xCenter + points.X * width / 2;
                    double yCoord = yCenter + points.Y * height / 2;
                    segment.Points.Add(new Point(xCoord, yCoord));
                }
                figure.StartPoint = segment.Points[0];
                figure.Segments.Add(segment);
                geometry.Figures.Add(figure);
            }
    
            for (int dec = -90; dec <= 90; dec = dec + 30)
            {
                figure = new PathFigure();
                segment = new PolyLineSegment();
                for (double ra = 12.01; ra <= 25; ra++)
                {
                    points = coords.GetAitoffCoord(ra, dec);
                    double xCoord = xCenter + points.X * width / 2;
                    double yCoord = yCenter + points.Y * height / 2;
                    segment.Points.Add(new Point(xCoord, yCoord));
                }
                figure.StartPoint = segment.Points[0];
                figure.Segments.Add(segment);
                geometry.Figures.Add(figure);
            }
    
            figure = new PathFigure();
            segment = new PolyLineSegment();
            for (int dec = -90; dec <= 90; dec = dec + 3)
            {
                double ra = 12.01;
                points = coords.GetAitoffCoord(ra, dec);
                double xCoord = xCenter + points.X * width / 2;
                double yCoord = yCenter + points.Y * height / 2;
                segment.Points.Add(new Point(xCoord, yCoord));
            }
            figure.StartPoint = segment.Points[0];
            figure.Segments.Add(segment);
            geometry.Figures.Add(figure);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying create a small http proxy service. This is not working so well.
I am trying create alert dailog using glade,but its not working .am i doing
I am trying create a layout. There are several inner layouts that should like
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
Ok so I am trying create a login script, here I am using PHP5
Trying to create several layers of folders at once C:\pie\applepie\recipies\ without using several different
hi I'm trying create chat using node.js I see example in http://chat.nodejs.org/ I have
I'm trying create a scaling layout for an Android application. The whole screen should
All, I am trying create a 'to & fro' animation using jquery animate &
Trying to create the following routine in MySQL Workbench yields a This object's DDL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.