head	8.7;
access;
symbols;
locks; strict;
comment	@ * @;


8.7
date	2026.05.11.12.01.11;	author mcalabre;	state Exp;
branches;
next	8.6;

8.6
date	2026.03.29.13.53.57;	author mcalabre;	state Exp;
branches
	8.6.1.1;
next	8.5;

8.5
date	2025.12.06.13.47.42;	author mcalabre;	state Exp;
branches
	8.5.1.1;
next	8.4;

8.4
date	2024.10.28.13.56.18;	author mcalabre;	state Exp;
branches
	8.4.1.1;
next	8.3;

8.3
date	2024.05.13.16.33.01;	author mcalabre;	state Exp;
branches
	8.3.1.1;
next	8.2;

8.2
date	2023.11.16.10.00.31;	author mcalabre;	state Exp;
branches
	8.2.1.1;
next	8.1;

8.1
date	2023.07.05.17.12.07;	author mcalabre;	state Exp;
branches
	8.1.1.1;
next	8.0;

8.0
date	2023.07.01.06.15.05;	author mcalabre;	state Exp;
branches
	8.0.1.1;
next	7.13;

7.13
date	2022.10.07.03.43.35;	author mcalabre;	state Exp;
branches
	7.13.1.1;
next	7.12;

7.12
date	2022.09.09.04.57.58;	author mcalabre;	state Exp;
branches
	7.12.1.1;
next	7.11;

7.11
date	2022.04.26.06.13.52;	author mcalabre;	state Exp;
branches
	7.11.1.1;
next	7.10;

7.10
date	2022.04.23.14.25.15;	author mcalabre;	state Exp;
branches
	7.10.1.1;
next	7.9;

7.9
date	2022.03.25.15.14.49;	author mcalabre;	state Exp;
branches
	7.9.1.1;
next	7.8;

7.8
date	2022.03.25.06.11.50;	author mcalabre;	state Exp;
branches
	7.8.1.1;
next	7.7;

7.7
date	2021.07.12.06.36.49;	author mcalabre;	state Exp;
branches
	7.7.1.1;
next	7.6;

7.6
date	2021.04.13.12.57.02;	author mcalabre;	state Exp;
branches
	7.6.1.1;
next	7.5;

7.5
date	2021.03.20.05.54.59;	author mcalabre;	state Exp;
branches
	7.5.1.1;
next	7.4;

7.4
date	2021.01.31.02.24.52;	author mcalabre;	state Exp;
branches
	7.4.1.1;
next	7.3;

7.3
date	2020.06.03.03.37.03;	author mcalabre;	state Exp;
branches
	7.3.1.1;
next	7.2;

7.2
date	2020.03.09.07.31.24;	author mcalabre;	state Exp;
branches
	7.2.1.1;
next	7.1;

7.1
date	2019.12.31.13.25.20;	author mcalabre;	state Exp;
branches
	7.1.1.1;
next	6.4;

6.4
date	2019.08.15.09.30.18;	author mcalabre;	state Exp;
branches
	6.4.1.1;
next	6.3;

6.3
date	2019.07.12.07.33.40;	author mcalabre;	state Exp;
branches
	6.3.1.1;
next	6.2;

6.2
date	2018.10.20.10.03.14;	author mcalabre;	state Exp;
branches
	6.2.1.1;
next	6.1;

6.1
date	2018.10.19.08.35.17;	author mcalabre;	state Exp;
branches
	6.1.1.1;
next	5.20;

5.20
date	2018.10.05.05.32.42;	author mcalabre;	state Exp;
branches
	5.20.1.1;
next	5.19;

5.19
date	2018.07.26.15.37.05;	author mcalabre;	state Exp;
branches
	5.19.1.1;
next	5.18;

5.18
date	2018.01.10.08.32.14;	author mcalabre;	state Exp;
branches
	5.18.1.1;
next	5.17;

5.17
date	2017.09.18.08.44.25;	author mcalabre;	state Exp;
branches
	5.17.1.1;
next	5.16;

5.16
date	2017.01.15.04.25.03;	author mcalabre;	state Exp;
branches
	5.16.1.1;
next	5.15;

5.15
date	2016.04.05.12.55.13;	author mcalabre;	state Exp;
branches
	5.15.1.1;
next	5.14;

5.14
date	2016.02.07.10.49.33;	author mcalabre;	state Exp;
branches
	5.14.1.1;
next	5.13;

5.13
date	2016.01.26.08.51.16;	author mcalabre;	state Exp;
branches
	5.13.1.1;
next	5.12;

5.12
date	2015.11.15.02.13.03;	author mcalabre;	state Exp;
branches
	5.12.1.1;
next	5.11;

5.11
date	2015.10.18.09.13.08;	author mcalabre;	state Exp;
branches
	5.11.1.1;
next	5.10;

5.10
date	2015.10.09.08.19.18;	author mcalabre;	state Exp;
branches
	5.10.1.1;
next	5.9;

5.9
date	2015.07.21.09.20.04;	author mcalabre;	state Exp;
branches
	5.9.1.1;
next	5.8;

5.8
date	2015.07.08.11.04.03;	author mcalabre;	state Exp;
branches
	5.8.1.1;
next	5.7;

5.7
date	2015.06.29.02.44.19;	author mcalabre;	state Exp;
branches
	5.7.1.1;
next	5.6;

5.6
date	2015.06.14.07.11.26;	author mcalabre;	state Exp;
branches
	5.6.1.1;
next	5.5;

5.5
date	2015.05.05.13.16.34;	author mcalabre;	state Exp;
branches
	5.5.1.1;
next	5.4;

5.4
date	2015.04.21.14.41.08;	author mcalabre;	state Exp;
branches
	5.4.1.1;
next	5.3;

5.3
date	2015.04.21.02.50.54;	author mcalabre;	state Exp;
branches
	5.3.1.1;
next	5.2;

5.2
date	2015.04.15.12.35.10;	author mcalabre;	state Exp;
branches
	5.2.1.1;
next	5.1;

5.1
date	2015.04.07.10.56.39;	author mcalabre;	state Exp;
branches
	5.1.1.1;
next	5.0;

5.0
date	2015.04.05.12.25.03;	author mcalabre;	state Exp;
branches
	5.0.1.1;
next	4.25;

4.25
date	2014.12.14.14.29.38;	author mcalabre;	state Exp;
branches
	4.25.1.1;
next	4.24;

4.24
date	2014.09.18.15.25.02;	author mcalabre;	state Exp;
branches
	4.24.1.1;
next	4.23;

4.23
date	2014.05.13.05.50.53;	author mcalabre;	state Exp;
branches
	4.23.1.1;
next	4.22;

4.22
date	2014.04.12.15.03.54;	author mcalabre;	state Exp;
branches
	4.22.1.1;
next	4.21;

4.21
date	2014.03.24.05.12.29;	author mcalabre;	state Exp;
branches
	4.21.1.1;
next	4.20;

4.20
date	2013.12.18.05.42.51;	author mcalabre;	state Exp;
branches
	4.20.1.1;
next	4.19;

4.19
date	2013.09.29.14.17.53;	author mcalabre;	state Exp;
branches
	4.19.1.1;
next	4.18;

4.18
date	2013.07.13.10.00.06;	author mcalabre;	state Exp;
branches
	4.18.1.1;
next	4.17;

4.17
date	2013.01.29.05.29.22;	author cal103;	state Exp;
branches
	4.17.1.1;
next	4.16;

4.16
date	2012.11.07.04.42.45;	author cal103;	state Exp;
branches
	4.16.1.1;
next	4.15;

4.15
date	2012.09.26.14.26.06;	author cal103;	state Exp;
branches
	4.15.1.1;
next	4.14;

4.14
date	2012.07.13.10.02.47;	author cal103;	state Exp;
branches
	4.14.1.1;
next	4.13;

4.13
date	2012.03.14.07.39.31;	author cal103;	state Exp;
branches
	4.13.1.1;
next	4.12;

4.12
date	2012.02.29.07.57.57;	author cal103;	state Exp;
branches
	4.12.1.1;
next	4.11;

4.11
date	2012.02.20.23.30.03;	author cal103;	state Exp;
branches
	4.11.1.1;
next	4.10;

4.10
date	2012.02.05.23.41.45;	author cal103;	state Exp;
branches
	4.10.1.1;
next	4.9;

4.9
date	2012.01.24.05.40.30;	author cal103;	state Exp;
branches
	4.9.1.1;
next	4.8;

4.8
date	2011.08.15.08.05.55;	author cal103;	state Exp;
branches
	4.8.1.1;
next	4.7;

4.7
date	2011.02.07.07.03.43;	author cal103;	state Exp;
branches
	4.7.1.1;
next	4.6;

4.6
date	2010.11.16.06.15.32;	author cal103;	state Exp;
branches
	4.6.1.1;
next	4.5;

4.5
date	2010.07.16.07.01.27;	author cal103;	state Exp;
branches
	4.5.1.1;
next	4.4;

4.4
date	2009.08.06.07.54.40;	author cal103;	state Exp;
branches
	4.4.1.1;
next	4.3;

4.3
date	2007.12.27.05.49.14;	author cal103;	state Exp;
branches
	4.3.1.1;
next	4.2;

4.2
date	2005.09.21.13.27.15;	author cal103;	state Exp;
branches
	4.2.1.1;
next	4.1;

4.1
date	2005.08.19.14.09.53;	author cal103;	state Exp;
branches;
next	4.0;

4.0
date	2005.02.04.12.24.01;	author cal103;	state Exp;
branches;
next	3.6;

3.6
date	2004.08.24.08.40.40;	author cal103;	state Exp;
branches;
next	3.5;

3.5
date	2004.06.28.05.38.20;	author mcalabre;	state Exp;
branches;
next	3.4;

3.4
date	2004.02.10.23.56.37;	author mcalabre;	state Exp;
branches;
next	3.3;

3.3
date	2003.10.22.08.45.00;	author mcalabre;	state Exp;
branches;
next	3.2;

3.2
date	2003.09.09.08.04.14;	author mcalabre;	state Exp;
branches;
next	3.1;

3.1
date	2003.04.28.05.24.34;	author mcalabre;	state Exp;
branches;
next	;

4.2.1.1
date	2005.12.05.03.23.34;	author cal103;	state Exp;
branches;
next	4.2.1.2;

4.2.1.2
date	2007.06.29.06.47.31;	author cal103;	state Exp;
branches;
next	4.2.1.3;

4.2.1.3
date	2007.12.03.05.41.29;	author cal103;	state Exp;
branches;
next	4.2.1.4;

4.2.1.4
date	2007.12.22.04.01.45;	author cal103;	state Exp;
branches;
next	;

4.3.1.1
date	2007.12.27.13.26.31;	author cal103;	state Exp;
branches;
next	4.3.1.2;

4.3.1.2
date	2009.07.23.04.17.17;	author cal103;	state Exp;
branches;
next	;

4.4.1.1
date	2009.08.10.08.55.45;	author cal103;	state Exp;
branches;
next	4.4.1.2;

4.4.1.2
date	2010.01.19.03.45.24;	author cal103;	state Exp;
branches;
next	;

4.5.1.1
date	2010.07.16.07.05.33;	author cal103;	state Exp;
branches;
next	;

4.6.1.1
date	2010.11.16.06.16.20;	author cal103;	state Exp;
branches;
next	4.6.1.2;

4.6.1.2
date	2011.01.14.06.35.20;	author cal103;	state Exp;
branches;
next	4.6.1.3;

4.6.1.3
date	2011.01.18.06.13.50;	author cal103;	state Exp;
branches;
next	;

4.7.1.1
date	2011.02.07.07.04.23;	author cal103;	state Exp;
branches;
next	;

4.8.1.1
date	2011.08.15.08.07.07;	author cal103;	state Exp;
branches;
next	4.8.1.2;

4.8.1.2
date	2012.01.24.05.24.50;	author cal103;	state Exp;
branches;
next	;

4.9.1.1
date	2012.01.24.05.41.46;	author cal103;	state Exp;
branches;
next	;

4.10.1.1
date	2012.02.05.23.42.47;	author cal103;	state Exp;
branches;
next	;

4.11.1.1
date	2012.02.20.23.31.14;	author cal103;	state Exp;
branches;
next	;

4.12.1.1
date	2012.02.29.07.59.11;	author cal103;	state Exp;
branches;
next	;

4.13.1.1
date	2012.03.14.07.40.39;	author cal103;	state Exp;
branches;
next	4.13.1.2;

4.13.1.2
date	2012.07.13.03.43.52;	author cal103;	state Exp;
branches;
next	;

4.14.1.1
date	2012.07.13.10.05.05;	author cal103;	state Exp;
branches;
next	;

4.15.1.1
date	2012.09.26.14.27.53;	author cal103;	state Exp;
branches;
next	;

4.16.1.1
date	2012.11.07.04.45.58;	author cal103;	state Exp;
branches;
next	4.16.1.2;

4.16.1.2
date	2013.01.29.05.11.32;	author cal103;	state Exp;
branches;
next	;

4.17.1.1
date	2013.01.29.05.32.33;	author cal103;	state Exp;
branches;
next	;

4.18.1.1
date	2013.07.13.10.02.40;	author mcalabre;	state Exp;
branches;
next	;

4.19.1.1
date	2013.09.29.14.20.41;	author mcalabre;	state Exp;
branches;
next	;

4.20.1.1
date	2013.12.18.05.46.57;	author mcalabre;	state Exp;
branches;
next	4.20.1.2;

4.20.1.2
date	2014.03.21.06.45.26;	author mcalabre;	state Exp;
branches;
next	;

4.21.1.1
date	2014.03.24.05.15.31;	author mcalabre;	state Exp;
branches;
next	;

4.22.1.1
date	2014.04.12.15.06.34;	author mcalabre;	state Exp;
branches;
next	;

4.23.1.1
date	2014.05.13.05.53.52;	author mcalabre;	state Exp;
branches;
next	;

4.24.1.1
date	2014.09.18.15.28.12;	author mcalabre;	state Exp;
branches;
next	;

4.25.1.1
date	2014.12.14.14.32.48;	author mcalabre;	state Exp;
branches;
next	4.25.1.2;

4.25.1.2
date	2015.01.06.01.03.14;	author mcalabre;	state Exp;
branches;
next	;

5.0.1.1
date	2015.04.05.12.28.04;	author mcalabre;	state Exp;
branches;
next	;

5.1.1.1
date	2015.04.07.11.01.13;	author mcalabre;	state Exp;
branches;
next	;

5.2.1.1
date	2015.04.15.12.39.18;	author mcalabre;	state Exp;
branches;
next	;

5.3.1.1
date	2015.04.21.02.54.06;	author mcalabre;	state Exp;
branches;
next	;

5.4.1.1
date	2015.04.21.14.44.32;	author mcalabre;	state Exp;
branches;
next	;

5.5.1.1
date	2015.05.05.13.21.04;	author mcalabre;	state Exp;
branches;
next	;

5.6.1.1
date	2015.06.14.07.14.48;	author mcalabre;	state Exp;
branches;
next	;

5.7.1.1
date	2015.06.29.02.47.27;	author mcalabre;	state Exp;
branches;
next	;

5.8.1.1
date	2015.07.08.11.07.22;	author mcalabre;	state Exp;
branches;
next	;

5.9.1.1
date	2015.07.21.09.28.12;	author mcalabre;	state Exp;
branches;
next	;

5.10.1.1
date	2015.10.09.08.22.40;	author mcalabre;	state Exp;
branches;
next	;

5.11.1.1
date	2015.10.18.09.16.31;	author mcalabre;	state Exp;
branches;
next	;

5.12.1.1
date	2015.11.15.02.16.18;	author mcalabre;	state Exp;
branches;
next	5.12.1.2;

5.12.1.2
date	2016.01.25.05.22.41;	author mcalabre;	state Exp;
branches;
next	;

5.13.1.1
date	2016.01.26.08.54.36;	author mcalabre;	state Exp;
branches;
next	;

5.14.1.1
date	2016.02.07.10.52.48;	author mcalabre;	state Exp;
branches;
next	;

5.15.1.1
date	2016.04.05.12.58.39;	author mcalabre;	state Exp;
branches;
next	5.15.1.2;

5.15.1.2
date	2017.01.15.04.08.24;	author mcalabre;	state Exp;
branches;
next	;

5.16.1.1
date	2017.01.15.04.29.04;	author mcalabre;	state Exp;
branches;
next	5.16.1.2;

5.16.1.2
date	2017.09.13.00.30.24;	author mcalabre;	state Exp;
branches;
next	;

5.17.1.1
date	2017.09.18.08.46.01;	author mcalabre;	state Exp;
branches;
next	5.17.1.2;

5.17.1.2
date	2018.01.10.08.27.33;	author mcalabre;	state Exp;
branches;
next	;

5.18.1.1
date	2018.01.10.08.33.04;	author mcalabre;	state Exp;
branches;
next	5.18.1.2;

5.18.1.2
date	2018.07.25.09.49.57;	author mcalabre;	state Exp;
branches;
next	;

5.19.1.1
date	2018.07.26.15.41.42;	author mcalabre;	state Exp;
branches;
next	;

5.20.1.1
date	2018.10.05.05.33.33;	author mcalabre;	state Exp;
branches;
next	;

6.1.1.1
date	2018.10.19.08.36.15;	author mcalabre;	state Exp;
branches;
next	;

6.2.1.1
date	2018.10.20.10.04.15;	author mcalabre;	state Exp;
branches;
next	6.2.1.2;

6.2.1.2
date	2019.05.10.02.13.12;	author mcalabre;	state Exp;
branches;
next	;

6.3.1.1
date	2019.07.12.07.34.37;	author mcalabre;	state Exp;
branches;
next	;

6.4.1.1
date	2019.08.15.09.31.29;	author mcalabre;	state Exp;
branches;
next	6.4.1.2;

6.4.1.2
date	2019.12.31.03.29.47;	author mcalabre;	state Exp;
branches;
next	;

7.1.1.1
date	2019.12.31.13.28.19;	author mcalabre;	state Exp;
branches;
next	;

7.2.1.1
date	2020.03.09.07.34.50;	author mcalabre;	state Exp;
branches;
next	;

7.3.1.1
date	2020.06.03.03.38.11;	author mcalabre;	state Exp;
branches;
next	7.3.1.2;

7.3.1.2
date	2020.08.17.11.24.44;	author mcalabre;	state Exp;
branches;
next	7.3.1.3;

7.3.1.3
date	2021.01.19.14.12.19;	author mcalabre;	state Exp;
branches;
next	7.3.1.4;

7.3.1.4
date	2021.01.28.12.32.51;	author mcalabre;	state Exp;
branches;
next	;

7.4.1.1
date	2021.01.31.02.26.24;	author mcalabre;	state Exp;
branches;
next	;

7.5.1.1
date	2021.03.20.05.56.42;	author mcalabre;	state Exp;
branches;
next	;

7.6.1.1
date	2021.04.13.13.00.37;	author mcalabre;	state Exp;
branches;
next	7.6.1.2;

7.6.1.2
date	2021.07.02.03.53.33;	author mcalabre;	state Exp;
branches;
next	;

7.7.1.1
date	2021.07.12.06.38.28;	author mcalabre;	state Exp;
branches;
next	7.7.1.2;

7.7.1.2
date	2022.03.25.06.06.01;	author mcalabre;	state Exp;
branches;
next	;

7.8.1.1
date	2022.03.25.06.14.15;	author mcalabre;	state Exp;
branches;
next	;

7.9.1.1
date	2022.03.25.15.16.40;	author mcalabre;	state Exp;
branches;
next	;

7.10.1.1
date	2022.04.23.14.26.55;	author mcalabre;	state Exp;
branches;
next	;

7.11.1.1
date	2022.04.26.06.15.33;	author mcalabre;	state Exp;
branches;
next	;

7.12.1.1
date	2022.09.09.05.00.36;	author mcalabre;	state Exp;
branches;
next	;

7.13.1.1
date	2022.10.07.03.45.47;	author mcalabre;	state Exp;
branches;
next	7.13.1.2;

7.13.1.2
date	2023.06.15.04.17.22;	author mcalabre;	state Exp;
branches;
next	;

8.0.1.1
date	2023.07.01.06.22.45;	author mcalabre;	state Exp;
branches;
next	;

8.1.1.1
date	2023.07.05.17.15.01;	author mcalabre;	state Exp;
branches;
next	;

8.2.1.1
date	2023.11.16.10.05.59;	author mcalabre;	state Exp;
branches;
next	8.2.1.2;

8.2.1.2
date	2024.04.02.13.43.15;	author mcalabre;	state Exp;
branches;
next	8.2.1.3;

8.2.1.3
date	2024.05.06.09.29.06;	author mcalabre;	state Exp;
branches;
next	;

8.3.1.1
date	2024.05.13.16.35.40;	author mcalabre;	state Exp;
branches;
next	;

8.4.1.1
date	2024.10.28.13.58.42;	author mcalabre;	state Exp;
branches;
next	8.4.1.2;

8.4.1.2
date	2025.12.06.13.37.20;	author mcalabre;	state Exp;
branches;
next	;

8.5.1.1
date	2025.12.06.14.05.17;	author mcalabre;	state Exp;
branches;
next	8.5.1.2;

8.5.1.2
date	2026.03.29.13.36.20;	author mcalabre;	state Exp;
branches;
next	;

8.6.1.1
date	2026.03.29.14.19.28;	author mcalabre;	state Exp;
branches;
next	;


desc
@Interface between PGSBOX and WCSLIB 3.x.  This is a C function (for
interfacing to WCSLIB) with a FORTRAN-like interface (for PGSBOX).
@


8.7
log
@WCSLIB 8.7
@
text
@/*============================================================================
  PGSBOX 8.7 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2026, Mark Calabretta

  This file is part of PGSBOX.

  PGSBOX is free software: you can redistribute it and/or modify it under the
  terms of the GNU Lesser General Public License as published by the Free
  Software Foundation, either version 3 of the License, or (at your option)
  any later version.

  PGSBOX is distributed in the hope that it will be useful, but WITHOUT ANY
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
  more details.

  You should have received a copy of the GNU Lesser General Public License
  along with PGSBOX.  If not, see http://www.gnu.org/licenses.

  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
  http://www.atnf.csiro.au/computing/software/wcs
  $Id: pgwcsl.c,v 8.6.1.1 2026/03/29 14:19:28 mcalabre Exp mcalabre $
*===========================================================================*/

#include <math.h>

#include <wcs.h>
#include <sph.h>

// Fortran name mangling.
#include <wcsconfig_f77.h>
#define pgwcsl_ F77_FUNC(pgwcsl, PGWCSL)

#ifdef BINDC
  #undef  pgwcsl_
  #define pgwcsl_ pgwcsl_c
#endif

void pgwcsl_(
  const int *opcode,
  const int *nlc,
  const int *nli,
  const int *nld,
  const char *nlcprm,
  int    *wcs,
  double *nldprm,
  double *world,
  double *pixel,
  int    *contrl,
  double contxt[20],
  int    *ierr)

{
  // Avert nuisance compiler warnings about unused parameters.
  (void)nlc;
  (void)nld;
  (void)nlcprm;
  (void)nldprm;

  int    stat;
  double imgcrd[9], phi, theta;
  static double wrld[9];

  struct wcsprm *wcsp = (struct wcsprm *)wcs;
  struct celprm *wcscel = &(wcsp->cel);

  *ierr = 0;

  if (*opcode == 2) {
    // Compute pixel coordinates from world coordinates.
    if (wcsp->lng < 0) {
      // Simple linear coordinates.
      if (wcss2p(wcsp, 1, 0, world, &phi, &theta, imgcrd, pixel, &stat)) {
        *ierr = 1;
      }
      return;
    }

    wrld[wcsp->lng] = world[0];
    int outside;
    if (world[1] > 90.0) {
      wrld[wcsp->lat] = 90.0;
      outside = -2;
    } else if (world[1] < -90.0) {
      wrld[wcsp->lat] = -90.0;
      outside = -2;
    } else {
      wrld[wcsp->lat] = world[1];
      outside = 0;
    }

    if (*contrl == 0) {
      if (wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd, pixel, &stat)) {
        // Translate status return values.
        *ierr = stat ? 2 : 1;
        return;
      }

      if (fabs(phi-contxt[2]) > 180.0) {
        // Hit a discontinuity at phi = +/- 180.
        contxt[4] = pixel[0];
        contxt[5] = pixel[1];

        double ph, dp;
        if (contxt[2] > phi) {
          ph = 179.9999;
          dp = (phi - contxt[2]) + 360.0;
        } else {
          ph = -179.9999;
          dp = (phi - contxt[2]) - 360.0;
        }

        // First approximation for theta.
        double th;
        if (dp == 0.0) {
          th = contxt[3];
        } else {
          th = contxt[3] + (ph-contxt[2])*(theta-contxt[3])/dp;
        }

        // Iterate once to refine the value of theta.
        double lng, lat;
        sphx2s(wcscel->euler, 1, 1, 1, 1, &ph, &th, &lng, &lat);
        if (wrld[wcsp->lng] == contxt[0]) {
          // We are following a meridian of longitude.
          lng = wrld[wcsp->lng];
        } else {
          // We are following a parallel of latitude.
          lat = wrld[wcsp->lat];
        }

        double sdummy;
        sphs2x(wcscel->euler, 1, 1, 1, 1, &lng, &lat, &sdummy, &th);

        contxt[0] = wrld[wcsp->lng];
        contxt[1] = wrld[wcsp->lat];
        contxt[2] = phi;
        contxt[3] = theta;

        // Pixel coordinates crossing into the discontinuity.
        sphx2s(wcscel->euler, 1, 1, 1, 1, &ph, &th, wrld+wcsp->lng,
          wrld+wcsp->lat);
        if (wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd, pixel, &stat)) {
          // Translate status return values.
          *ierr = stat ? 2 : 1;
          return;
        }

        // Pixel coordinates crossing out of the discontinuity.
        ph *= -1.0;
        sphx2s(wcscel->euler, 1, 1, 1, 1, &ph, &th, wrld+wcsp->lng,
          wrld+wcsp->lat);
        if (wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd, contxt+6, &stat)) {
          // Translate status return values.
          *ierr = stat ? 2 : 1;
          return;
        }

        *contrl = 1;
      } else {
        // Normal mode, no discontinuity.
        contxt[0] = wrld[wcsp->lng];
        contxt[1] = wrld[wcsp->lat];
        contxt[2] = phi;
        contxt[3] = theta;
      }
    } else {
      if (*contrl == 1) {
        // Move to the other side of the discontinuity.
        pixel[0] = contxt[6];
        pixel[1] = contxt[7];
        *contrl = 2;
      } else {
        // Complete the traversal.
        pixel[0] = contxt[4];
        pixel[1] = contxt[5];
        *contrl = 0;
      }
    }

    *ierr = outside;

  } else if (*opcode == 1) {
    // Compute pixel coordinates from world coordinates.
    if (wcsp->lng < 0) {
      // Simple linear coordinates.
      if (wcss2p(wcsp, 1, 0, world, &phi, &theta, imgcrd, pixel, &stat)) {
        *ierr = 1;
      }
      return;
    }

    wrld[wcsp->lng] = world[0];
    int outside;
    if (world[1] > 90.0) {
      wrld[wcsp->lat] = 90.0;
      outside = -2;
    } else if (world[1] < -90.0) {
      wrld[wcsp->lat] = -90.0;
      outside = -2;
    } else {
      wrld[wcsp->lat] = world[1];
      outside = 0;
    }

    if (wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd, pixel, &stat)) {
      // Translate status return values.
      *ierr = stat ? 2 : 1;
      return;
    }

    contxt[0] = wrld[wcsp->lng];
    contxt[1] = wrld[wcsp->lat];
    contxt[2] = phi;
    contxt[3] = theta;

    *ierr = outside;

  } else if (*opcode == 0) {
    // Initialize.
    if (*nli < (int)WCSLEN) {
      *ierr = 1;
      return;
    }

    if ((*ierr = wcsset(wcsp))) {
      *ierr = *ierr <= 2 ? 1 : 2;
    }

    for (int i = 2; i < 9; i++) {
      wrld[i] = 0.0;
    }

    *contrl = 0;

  } else if (*opcode == -1) {
    // Compute world coordinates from pixel coordinates.
    if (wcsp2s(wcsp, 1, 0, pixel, imgcrd, &phi, &theta, wrld, &stat)) {
      // Translate status return values.
      *ierr = stat ? 3 : 1;
      return;
    }

    if (wcsp->lng < 0) {
      // Simple linear coordinates.
      world[0] = wrld[0];
      world[1] = wrld[1];
    } else {
      world[0] = wrld[wcsp->lng];
      world[1] = wrld[wcsp->lat];

      if (phi < -180.0 || phi > 180.0) {
        // Pixel is outside the principle range of native longitude.
        *ierr = 3;
        return;
      }
    }

  } else {
    *ierr = 1;
  }

  return;
}
@


8.6
log
@WCSLIB 8.6
@
text
@d2 1
a2 1
  PGSBOX 8.6 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: pgwcsl.c,v 8.5.1.2 2026/03/29 13:36:20 mcalabre Exp mcalabre $
@


8.6.1.1
log
@WCSLIB 8.6 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 8.6 2026/03/29 13:53:57 mcalabre Exp $
@


8.5
log
@WCSLIB 8.5
@
text
@d2 2
a3 2
  PGSBOX 8.5 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2025, Mark Calabretta
d21 2
a22 2
  http://www.atnf.csiro.au/people/Mark.Calabretta
  $Id: pgwcsl.c,v 8.4.1.2 2025/12/06 13:37:20 mcalabre Exp mcalabre $
@


8.5.1.1
log
@WCSLIB 8.5 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 8.5 2025/12/06 13:47:42 mcalabre Exp $
@


8.5.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1997-2026, Mark Calabretta
d21 2
a22 2
  http://www.atnf.csiro.au/computing/software/wcs
  $Id: pgwcsl.c,v 8.5.1.1 2025/12/06 14:05:17 mcalabre Exp mcalabre $
@


8.4
log
@WCSLIB 8.4
@
text
@d2 2
a3 2
  PGSBOX 8.4 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2024, Mark Calabretta
d22 1
a22 1
  $Id: pgwcsl.c,v 8.3.1.1 2024/05/13 16:35:40 mcalabre Exp mcalabre $
@


8.4.1.1
log
@WCSLIB 8.4 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 8.4 2024/10/28 13:56:18 mcalabre Exp $
@


8.4.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1997-2025, Mark Calabretta
d22 1
a22 1
  $Id: pgwcsl.c,v 8.4.1.1 2024/10/28 13:58:42 mcalabre Exp mcalabre $
@


8.3
log
@WCSLIB 8.3
@
text
@d2 1
a2 1
  PGSBOX 8.3 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: pgwcsl.c,v 8.2.1.3 2024/05/06 09:29:06 mcalabre Exp mcalabre $
@


8.3.1.1
log
@WCSLIB 8.3 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 8.3 2024/05/13 16:33:01 mcalabre Exp $
@


8.2
log
@WCSLIB 8.2
@
text
@d2 2
a3 2
  PGSBOX 8.2 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2023, Mark Calabretta
d22 1
a22 1
  $Id: pgwcsl.c,v 8.1.1.1 2023/07/05 17:15:01 mcalabre Exp mcalabre $
d33 5
@


8.2.1.1
log
@WCSLIB 8.2 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 8.2 2023/11/16 10:00:31 mcalabre Exp $
@


8.2.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1997-2024, Mark Calabretta
d22 1
a22 1
  $Id: pgwcsl.c,v 8.2.1.1 2023/11/16 10:05:59 mcalabre Exp mcalabre $
@


8.2.1.3
log
@Changes required to support the new Fortran 2003 BIND(C) wrappers.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 8.2.1.2 2024/04/02 13:43:15 mcalabre Exp mcalabre $
a32 5

#ifdef BINDC
  #undef  pgwcsl_
  #define pgwcsl_ pgwcsl_c
#endif
@


8.1
log
@WCSLIB 8.1
@
text
@d2 1
a2 1
  PGSBOX 8.1 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: pgwcsl.c,v 8.0.1.1 2023/07/01 06:22:45 mcalabre Exp mcalabre $
@


8.1.1.1
log
@WCSLIB 8.1 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $
@


8.0
log
@WCSLIB 8.0
@
text
@d2 1
a2 1
  PGSBOX 8.0 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: pgwcsl.c,v 7.13.1.2 2023/06/15 04:17:22 mcalabre Exp mcalabre $
@


8.0.1.1
log
@WCSLIB 8.0 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 8.0 2023/07/01 06:15:05 mcalabre Exp $
@


7.13
log
@WCSLIB 7.13
@
text
@d2 2
a3 2
  PGSBOX 7.13 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2022, Mark Calabretta
d22 1
a22 1
  $Id: pgwcsl.c,v 7.12.1.1 2022/09/09 05:00:36 mcalabre Exp mcalabre $
@


7.13.1.1
log
@WCSLIB 7.13 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 7.13 2022/10/07 03:43:35 mcalabre Exp $
@


7.13.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1997-2023, Mark Calabretta
d22 1
a22 1
  $Id: pgwcsl.c,v 7.13.1.1 2022/10/07 03:45:47 mcalabre Exp mcalabre $
@


7.12
log
@WCSLIB 7.12
@
text
@d2 1
a2 1
  PGSBOX 7.12 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: pgwcsl.c,v 7.11.1.1 2022/04/26 06:15:33 mcalabre Exp mcalabre $
@


7.12.1.1
log
@WCSLIB 7.12 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 7.12 2022/09/09 04:57:58 mcalabre Exp $
@


7.11
log
@WCSLIB 7.11
@
text
@d2 1
a2 1
  PGSBOX 7.11 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: pgwcsl.c,v 7.10.1.1 2022/04/23 14:26:55 mcalabre Exp mcalabre $
@


7.11.1.1
log
@WCSLIB 7.11 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 7.11 2022/04/26 06:13:52 mcalabre Exp $
@


7.10
log
@WCSLIB 7.10
@
text
@d2 1
a2 1
  PGSBOX 7.10 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: pgwcsl.c,v 7.9.1.1 2022/03/25 15:16:40 mcalabre Exp mcalabre $
@


7.10.1.1
log
@WCSLIB 7.10 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 7.10 2022/04/23 14:25:15 mcalabre Exp $
@


7.9
log
@WCSLIB 7.9
@
text
@d2 1
a2 1
  PGSBOX 7.9 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: pgwcsl.c,v 7.8.1.1 2022/03/25 06:14:15 mcalabre Exp mcalabre $
@


7.9.1.1
log
@WCSLIB 7.9 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 7.9 2022/03/25 15:14:49 mcalabre Exp $
@


7.8
log
@WCSLIB 7.8
@
text
@d2 1
a2 1
  PGSBOX 7.8 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: pgwcsl.c,v 7.7.1.2 2022/03/25 06:06:01 mcalabre Exp mcalabre $
@


7.8.1.1
log
@WCSLIB 7.8 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 7.8 2022/03/25 06:11:50 mcalabre Exp $
@


7.7
log
@WCSLIB 7.7
@
text
@d2 2
a3 2
  PGSBOX 7.7 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2021, Mark Calabretta
d22 1
a22 1
  $Id: pgwcsl.c,v 7.6.1.2 2021/07/02 03:53:33 mcalabre Exp mcalabre $
@


7.7.1.1
log
@WCSLIB 7.7 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 7.7 2021/07/12 06:36:49 mcalabre Exp $
@


7.7.1.2
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1997-2022, Mark Calabretta
d22 1
a22 1
  $Id: pgwcsl.c,v 7.7.1.1 2021/07/12 06:38:28 mcalabre Exp mcalabre $
@


7.6
log
@WCSLIB 7.6
@
text
@d2 1
a2 1
  PGSBOX 7.6 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: pgwcsl.c,v 7.5.1.1 2021/03/20 05:56:42 mcalabre Exp mcalabre $
d34 13
a46 12
void pgwcsl_(opcode, nlc, nli, nld, nlcprm, wcs, nldprm, world, pixel, contrl,
            contxt, ierr)

const int *opcode, *nlc, *nli, *nld;
const char *nlcprm;
int *wcs;
double *nldprm;
double *world;
double *pixel;
int *contrl;
double contxt[20];
int *ierr;
a48 6
  int i, outside, stat;
  double dp, imgcrd[9], lat, lng, ph, phi, sdummy, th, theta;
  static double wrld[9];
  struct wcsprm *wcsp;
  struct celprm *wcscel;

d55 7
a63 3
  wcsp = (struct wcsprm *)wcs;
  wcscel = &(wcsp->cel);

d75 1
d99 1
d109 1
d117 1
d126 2
d189 1
d225 1
a225 1
    for (i = 2; i < 9; i++) {
@


7.6.1.1
log
@WCSLIB 7.6 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 7.6 2021/04/13 12:57:02 mcalabre Exp $
@


7.6.1.2
log
@Converted from K&R to C89-style function definition and C99-style intermingled
variable declarations.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 7.6.1.1 2021/04/13 13:00:37 mcalabre Exp mcalabre $
d34 12
a45 13
void pgwcsl_(
  const int *opcode,
  const int *nlc,
  const int *nli,
  const int *nld,
  const char *nlcprm,
  int    *wcs,
  double *nldprm,
  double *world,
  double *pixel,
  int    *contrl,
  double contxt[20],
  int    *ierr)
d48 6
d60 1
a60 6
  int    stat;
  double imgcrd[9], phi, theta;
  static double wrld[9];

  struct wcsprm *wcsp = (struct wcsprm *)wcs;
  struct celprm *wcscel = &(wcsp->cel);
d62 2
a63 1
  *ierr = 0;
a75 1
    int outside;
a98 1
        double ph, dp;
a107 1
        double th;
a114 1
        double lng, lat;
a122 2

        double sdummy;
a183 1
    int outside;
d219 1
a219 1
    for (int i = 2; i < 9; i++) {
@


7.5
log
@WCSLIB 7.5
@
text
@d2 1
a2 1
  PGSBOX 7.5 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: pgwcsl.c,v 7.4.1.1 2021/01/31 02:26:24 mcalabre Exp mcalabre $
@


7.5.1.1
log
@WCSLIB 7.5 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 7.5 2021/03/20 05:54:59 mcalabre Exp $
@


7.4
log
@WCSLIB 7.4
@
text
@d2 1
a2 1
  PGSBOX 7.4 - draw curvilinear coordinate axes for PGPLOT.
d22 1
a22 1
  $Id: pgwcsl.c,v 7.3.1.4 2021/01/28 12:32:51 mcalabre Exp mcalabre $
@


7.4.1.1
log
@WCSLIB 7.4 development branch.
@
text
@d22 1
a22 1
  $Id: pgwcsl.c,v 7.4 2021/01/31 02:24:52 mcalabre Exp $
@


7.3
log
@WCSLIB 7.3
@
text
@d2 2
a3 3

  PGSBOX 7.3 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2020, Mark Calabretta
a19 2
  Direct correspondence concerning PGSBOX to mark@@calabretta.id.au

d22 1
a22 1
  $Id: pgwcsl.c,v 7.2.1.1 2020/03/09 07:34:50 mcalabre Exp mcalabre $
d30 1
a30 1
/* Fortran name mangling. */
d54 1
a54 1
  /* Avert nuisance compiler warnings about unused parameters. */
d66 1
a66 1
    /* Compute pixel coordinates from world coordinates. */
d68 1
a68 1
      /* Simple linear coordinates. */
d89 1
a89 1
        /* Translate status return values. */
d95 1
a95 1
        /* Hit a discontinuity at phi = +/- 180. */
d107 1
a107 1
        /* First approximation for theta. */
d114 1
a114 1
        /* Iterate once to refine the value of theta. */
d117 1
a117 1
          /* We are following a meridian of longitude. */
d120 1
a120 1
          /* We are following a parallel of latitude. */
d130 1
a130 1
        /* Pixel coordinates crossing into the discontinuity. */
d134 1
a134 1
          /* Translate status return values. */
d139 1
a139 1
        /* Pixel coordinates crossing out of the discontinuity. */
d144 1
a144 1
          /* Translate status return values. */
d151 1
a151 1
        /* Normal mode, no discontinuity. */
d159 1
a159 1
        /* Move to the other side of the discontinuity. */
d164 1
a164 1
        /* Complete the traversal. */
d174 1
a174 1
    /* Compute pixel coordinates from world coordinates. */
d176 1
a176 1
      /* Simple linear coordinates. */
d196 1
a196 1
      /* Translate status return values. */
d209 1
a209 1
    /* Initialize. */
d226 1
a226 1
    /* Compute world coordinates from pixel coordinates. */
d228 1
a228 1
      /* Translate status return values. */
d234 1
a234 1
      /* Simple linear coordinates. */
d242 1
a242 1
        /* Pixel is outside the principle range of native longitude. */
@


7.3.1.1
log
@WCSLIB 7.3 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 7.3 2020/06/03 03:37:03 mcalabre Exp $
@


7.3.1.2
log
@Switched to C99 style commenting (i.e. using //) within the code.
@
text
@d2 1
d25 1
a25 1
  $Id: pgwcsl.c,v 7.3.1.1 2020/06/03 03:38:11 mcalabre Exp mcalabre $
d33 1
a33 1
// Fortran name mangling.
d57 1
a57 1
  // Avert nuisance compiler warnings about unused parameters.
d69 1
a69 1
    // Compute pixel coordinates from world coordinates.
d71 1
a71 1
      // Simple linear coordinates.
d92 1
a92 1
        // Translate status return values.
d98 1
a98 1
        // Hit a discontinuity at phi = +/- 180.
d110 1
a110 1
        // First approximation for theta.
d117 1
a117 1
        // Iterate once to refine the value of theta.
d120 1
a120 1
          // We are following a meridian of longitude.
d123 1
a123 1
          // We are following a parallel of latitude.
d133 1
a133 1
        // Pixel coordinates crossing into the discontinuity.
d137 1
a137 1
          // Translate status return values.
d142 1
a142 1
        // Pixel coordinates crossing out of the discontinuity.
d147 1
a147 1
          // Translate status return values.
d154 1
a154 1
        // Normal mode, no discontinuity.
d162 1
a162 1
        // Move to the other side of the discontinuity.
d167 1
a167 1
        // Complete the traversal.
d177 1
a177 1
    // Compute pixel coordinates from world coordinates.
d179 1
a179 1
      // Simple linear coordinates.
d199 1
a199 1
      // Translate status return values.
d212 1
a212 1
    // Initialize.
d229 1
a229 1
    // Compute world coordinates from pixel coordinates.
d231 1
a231 1
      // Translate status return values.
d237 1
a237 1
      // Simple linear coordinates.
d245 1
a245 1
        // Pixel is outside the principle range of native longitude.
@


7.3.1.3
log
@Updated date in copyright notice.
@
text
@d3 1
a3 1
  Copyright (C) 1997-2021, Mark Calabretta
d24 1
a24 1
  $Id: pgwcsl.c,v 7.3.1.2 2020/08/17 11:24:44 mcalabre Exp mcalabre $
@


7.3.1.4
log
@Removed my email address from the copyright notice.
@
text
@d20 2
d24 1
a24 1
  $Id: pgwcsl.c,v 7.3.1.3 2021/01/19 14:12:19 mcalabre Exp mcalabre $
@


7.2
log
@WCSLIB 7.2
@
text
@d3 1
a3 1
  PGSBOX 7.2 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 7.1.1.1 2019/12/31 13:28:19 mcalabre Exp mcalabre $
@


7.2.1.1
log
@WCSLIB 7.2 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 7.2 2020/03/09 07:31:24 mcalabre Exp $
@


7.1
log
@WCSLIB 7.1
@
text
@d3 1
a3 1
  PGSBOX 7.1 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 6.4.1.2 2019/12/31 03:29:47 mcalabre Exp mcalabre $
@


7.1.1.1
log
@WCSLIB 7.1 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 7.1 2019/12/31 13:25:20 mcalabre Exp $
@


6.4
log
@WCSLIB 6.4
@
text
@d3 2
a4 2
  PGSBOX 6.4 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2019, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 6.3.1.1 2019/07/12 07:34:37 mcalabre Exp mcalabre $
@


6.4.1.1
log
@WCSLIB 6.4 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 6.4 2019/08/15 09:30:18 mcalabre Exp $
@


6.4.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2020, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 6.4.1.1 2019/08/15 09:31:29 mcalabre Exp mcalabre $
@


6.3
log
@WCSLIB 6.3
@
text
@d3 1
a3 1
  PGSBOX 6.3 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 6.2.1.2 2019/05/10 02:13:12 mcalabre Exp mcalabre $
@


6.3.1.1
log
@WCSLIB 6.3 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 6.3 2019/07/12 07:33:40 mcalabre Exp $
@


6.2
log
@WCSLIB 6.2
@
text
@d3 2
a4 2
  PGSBOX 6.2 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2018, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 6.1.1.1 2018/10/19 08:36:15 mcalabre Exp mcalabre $
@


6.2.1.1
log
@WCSLIB 6.2 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 6.2 2018/10/20 10:03:14 mcalabre Exp $
@


6.2.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2019, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 6.2.1.1 2018/10/20 10:04:15 mcalabre Exp mcalabre $
@


6.1
log
@WCSLIB 6.1
@
text
@d3 1
a3 1
  PGSBOX 6.1 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.20.1.1 2018/10/05 05:33:33 mcalabre Exp mcalabre $
@


6.1.1.1
log
@WCSLIB 6.1 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 6.1 2018/10/19 08:35:17 mcalabre Exp $
@


5.20
log
@WCSLIB 5.20
@
text
@d3 1
a3 1
  PGSBOX 5.20 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.19.1.1 2018/07/26 15:41:42 mcalabre Exp mcalabre $
@


5.20.1.1
log
@WCSLIB 5.20 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.20 2018/10/05 05:32:42 mcalabre Exp $
@


5.19
log
@WCSLIB 5.19
@
text
@d3 1
a3 1
  PGSBOX 5.19 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.18.1.2 2018/07/25 09:49:57 mcalabre Exp mcalabre $
@


5.19.1.1
log
@WCSLIB 5.19 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.19 2018/07/26 15:37:05 mcalabre Exp $
@


5.18
log
@WCSLIB 5.18
@
text
@d3 1
a3 1
  PGSBOX 5.18 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.17.1.2 2018/01/10 08:27:33 mcalabre Exp mcalabre $
d56 6
@


5.18.1.1
log
@WCSLIB 5.18 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.18 2018/01/10 08:32:14 mcalabre Exp $
@


5.18.1.2
log
@Avert nuisance compiler warnings about unused parameters
(gcc -Wunused-parameter).
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.18.1.1 2018/01/10 08:33:04 mcalabre Exp mcalabre $
a55 6

  /* Avert nuisance compiler warnings about unused parameters. */
  (void)nlc;
  (void)nld;
  (void)nlcprm;
  (void)nldprm;
@


5.17
log
@WCSLIB 5.17
@
text
@d3 2
a4 2
  PGSBOX 5.17 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2017, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 5.16.1.2 2017/09/13 00:30:24 mcalabre Exp mcalabre $
@


5.17.1.1
log
@WCSLIB 5.17 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.17 2017/09/18 08:44:25 mcalabre Exp $
@


5.17.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2018, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 5.17.1.1 2017/09/18 08:46:01 mcalabre Exp mcalabre $
@


5.16
log
@WCSLIB 5.16
@
text
@d3 1
a3 1
  PGSBOX 5.16 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.15.1.2 2017/01/15 04:08:24 mcalabre Exp mcalabre $
d207 1
a207 1
    if (*nli < WCSLEN) {
@


5.16.1.1
log
@WCSLIB 5.16 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.16 2017/01/15 04:25:03 mcalabre Exp $
@


5.16.1.2
log
@Fixed a compiler warning about comparison between signed and unsigned ints.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.16.1.1 2017/01/15 04:29:04 mcalabre Exp mcalabre $
d207 1
a207 1
    if (*nli < (int)WCSLEN) {
@


5.15
log
@WCSLIB 5.15
@
text
@d3 2
a4 2
  PGSBOX 5.15 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2016, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 5.14.1.1 2016/02/07 10:52:48 mcalabre Exp mcalabre $
@


5.15.1.1
log
@WCSLIB 5.15 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.15 2016/04/05 12:55:13 mcalabre Exp $
@


5.15.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2017, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 5.15.1.1 2016/04/05 12:58:39 mcalabre Exp mcalabre $
@


5.14
log
@WCSLIB 5.14
@
text
@d3 1
a3 1
  PGSBOX 5.14 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.13.1.1 2016/01/26 08:54:36 mcalabre Exp mcalabre $
@


5.14.1.1
log
@WCSLIB 5.14 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.14 2016/02/07 10:49:33 mcalabre Exp $
@


5.13
log
@WCSLIB 5.13
@
text
@d3 1
a3 1
  PGSBOX 5.13 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.12.1.2 2016/01/25 05:22:41 mcalabre Exp mcalabre $
@


5.13.1.1
log
@WCSLIB 5.13 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.13 2016/01/26 08:51:16 mcalabre Exp $
@


5.12
log
@WCSLIB 5.12
@
text
@d3 2
a4 2
  PGSBOX 5.12 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2015, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 5.11.1.1 2015/10/18 09:16:31 mcalabre Exp mcalabre $
@


5.12.1.1
log
@WCSLIB 5.12 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.12 2015/11/15 02:13:03 mcalabre Exp $
@


5.12.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2016, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 5.12.1.1 2015/11/15 02:16:18 mcalabre Exp mcalabre $
@


5.11
log
@WCSLIB 5.11
@
text
@d3 1
a3 1
  PGSBOX 5.11 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.10.1.1 2015/10/09 08:22:40 mcalabre Exp mcalabre $
@


5.11.1.1
log
@WCSLIB 5.11 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.11 2015/10/18 09:13:08 mcalabre Exp $
@


5.10
log
@WCSLIB 5.10
@
text
@d3 1
a3 1
  PGSBOX 5.10 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.9.1.1 2015/07/21 09:28:12 mcalabre Exp mcalabre $
@


5.10.1.1
log
@WCSLIB 5.10 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.10 2015/10/09 08:19:18 mcalabre Exp $
@


5.9
log
@WCSLIB 5.9
@
text
@d3 1
a3 1
  PGSBOX 5.9 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.8.1.1 2015/07/08 11:07:22 mcalabre Exp mcalabre $
@


5.9.1.1
log
@WCSLIB 5.9 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.9 2015/07/21 09:20:04 mcalabre Exp $
@


5.8
log
@WCSLIB 5.8
@
text
@d3 1
a3 1
  PGSBOX 5.8 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.7.1.1 2015/06/29 02:47:27 mcalabre Exp mcalabre $
@


5.8.1.1
log
@WCSLIB 5.8 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.8 2015/07/08 11:04:03 mcalabre Exp $
@


5.7
log
@WCSLIB 5.7
@
text
@d3 1
a3 1
  PGSBOX 5.7 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.6.1.1 2015/06/14 07:14:48 mcalabre Exp mcalabre $
@


5.7.1.1
log
@WCSLIB 5.7 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.7 2015/06/29 02:44:19 mcalabre Exp $
@


5.6
log
@WCSLIB 5.6
@
text
@d3 1
a3 1
  PGSBOX 5.6 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.5.1.1 2015/05/05 13:21:04 mcalabre Exp mcalabre $
@


5.6.1.1
log
@WCSLIB 5.6 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.6 2015/06/14 07:11:26 mcalabre Exp $
@


5.5
log
@WCSLIB 5.5
@
text
@d3 1
a3 1
  PGSBOX 5.5 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.4.1.1 2015/04/21 14:44:32 mcalabre Exp mcalabre $
@


5.5.1.1
log
@WCSLIB 5.5 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.5 2015/05/05 13:16:34 mcalabre Exp $
@


5.4
log
@WCSLIB 5.4
@
text
@d3 1
a3 1
  PGSBOX 5.4 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.3.1.1 2015/04/21 02:54:06 mcalabre Exp mcalabre $
@


5.4.1.1
log
@WCSLIB 5.4 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.4 2015/04/21 14:41:08 mcalabre Exp $
@


5.3
log
@WCSLIB 5.3
@
text
@d3 1
a3 1
  PGSBOX 5.3 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.2.1.1 2015/04/15 12:39:18 mcalabre Exp mcalabre $
@


5.3.1.1
log
@WCSLIB 5.3 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.3 2015/04/21 02:50:54 mcalabre Exp $
@


5.2
log
@WCSLIB 5.2
@
text
@d3 1
a3 1
  PGSBOX 5.2 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.1.1.1 2015/04/07 11:01:13 mcalabre Exp mcalabre $
@


5.2.1.1
log
@WCSLIB 5.2 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.2 2015/04/15 12:35:10 mcalabre Exp $
@


5.1
log
@WCSLIB 5.1
@
text
@d3 1
a3 1
  PGSBOX 5.1 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 5.0.1.1 2015/04/05 12:28:04 mcalabre Exp mcalabre $
@


5.1.1.1
log
@WCSLIB 5.1 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.1 2015/04/07 10:56:39 mcalabre Exp $
@


5.0
log
@WCSLIB 5.0
@
text
@d3 1
a3 1
  PGSBOX 5.0 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 4.25.1.2 2015/01/06 01:03:14 mcalabre Exp mcalabre $
@


5.0.1.1
log
@WCSLIB 5.0 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 5.0 2015/04/05 12:25:03 mcalabre Exp $
@


4.25
log
@WCSLIB 4.25
@
text
@d3 2
a4 2
  PGSBOX 4.25 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2014, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 4.24.1.1 2014/09/18 15:28:12 mcalabre Exp mcalabre $
@


4.25.1.1
log
@WCSLIB 4.25 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 4.25 2014/12/14 14:29:38 mcalabre Exp $
@


4.25.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2015, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 4.25.1.1 2014/12/14 14:32:48 mcalabre Exp mcalabre $
@


4.24
log
@WCSLIB 4.24
@
text
@d3 1
a3 1
  PGSBOX 4.24 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 4.23.1.1 2014/05/13 05:53:52 mcalabre Exp mcalabre $
@


4.24.1.1
log
@WCSLIB 4.24 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 4.24 2014/09/18 15:25:02 mcalabre Exp $
@


4.23
log
@WCSLIB 4.23
@
text
@d3 1
a3 1
  PGSBOX 4.23 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 4.22.1.1 2014/04/12 15:06:34 mcalabre Exp mcalabre $
@


4.23.1.1
log
@WCSLIB 4.23 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 4.23 2014/05/13 05:50:53 mcalabre Exp $
@


4.22
log
@WCSLIB 4.22
@
text
@d3 1
a3 1
  PGSBOX 4.22 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 4.21.1.1 2014/03/24 05:15:31 mcalabre Exp mcalabre $
@


4.22.1.1
log
@WCSLIB 4.22 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 4.22 2014/04/12 15:03:54 mcalabre Exp $
@


4.21
log
@WCSLIB 4.21
@
text
@d3 1
a3 1
  PGSBOX 4.21 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 4.20.1.2 2014/03/21 06:45:26 mcalabre Exp mcalabre $
@


4.21.1.1
log
@WCSLIB 4.21 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 4.21 2014/03/24 05:12:29 mcalabre Exp $
@


4.20
log
@WCSLIB 4.20
@
text
@d3 2
a4 2
  PGSBOX 4.20 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2013, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 4.19.1.1 2013/09/29 14:20:41 mcalabre Exp mcalabre $
@


4.20.1.1
log
@WCSLIB 4.20 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 4.20 2013/12/18 05:42:51 mcalabre Exp $
@


4.20.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2014, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 4.20.1.1 2013/12/18 05:46:57 mcalabre Exp mcalabre $
@


4.19
log
@WCSLIB 4.19
@
text
@d3 1
a3 1
  PGSBOX 4.19 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 4.18.1.1 2013/07/13 10:02:40 mcalabre Exp mcalabre $
@


4.19.1.1
log
@WCSLIB 4.19 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 4.19 2013/09/29 14:17:53 mcalabre Exp $
@


4.18
log
@WCSLIB 4.18
@
text
@d3 1
a3 1
  PGSBOX 4.18 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 4.17.1.1 2013/01/29 05:32:33 cal103 Exp cal103 $
@


4.18.1.1
log
@WCSLIB 4.18 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 4.18 2013/07/13 10:00:06 mcalabre Exp $
@


4.17
log
@WCSLIB 4.17
@
text
@d3 1
a3 1
  PGSBOX 4.17 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 4.16.1.2 2013/01/29 05:11:32 cal103 Exp cal103 $
@


4.17.1.1
log
@WCSLIB 4.17 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 4.17 2013/01/29 05:29:22 cal103 Exp $
@


4.16
log
@WCSLIB 4.16
@
text
@d3 2
a4 2
  PGSBOX 4.16 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2012, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 4.15.1.1 2012/09/26 14:27:53 cal103 Exp cal103 $
@


4.16.1.1
log
@WCSLIB 4.16 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 4.16 2012/11/07 04:42:45 cal103 Exp $
@


4.16.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2013, Mark Calabretta
d25 1
a25 1
  $Id: pgwcsl.c,v 4.16.1.1 2012/11/07 04:45:58 cal103 Exp cal103 $
@


4.15
log
@WCSLIB 4.15
@
text
@d3 1
a3 1
  PGSBOX 4.15 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 4.14.1.1 2012/07/13 10:05:05 cal103 Exp cal103 $
@


4.15.1.1
log
@WCSLIB 4.15 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 4.15 2012/09/26 14:26:06 cal103 Exp $
@


4.14
log
@WCSLIB 4.14
@
text
@d3 1
a3 1
  PGSBOX 4.14 - draw curvilinear coordinate axes for PGPLOT.
d25 1
a25 1
  $Id: pgwcsl.c,v 4.13.1.2 2012/07/13 03:43:52 cal103 Exp cal103 $
@


4.14.1.1
log
@WCSLIB 4.14 development branch.
@
text
@d25 1
a25 1
  $Id: pgwcsl.c,v 4.14 2012/07/13 10:02:47 cal103 Exp $
@


4.13
log
@WCSLIB 4.13
@
text
@d3 1
a3 1
  PGSBOX 4.13 - draw curvilinear coordinate axes for PGPLOT.
d19 1
a19 1
  along with PGSBOX.  If not, see <http://www.gnu.org/licenses/>.
d21 5
a25 11
  Correspondence concerning PGSBOX may be directed to:
    Internet email: mcalabre@@atnf.csiro.au
    Postal address: Dr. Mark Calabretta
                    Australia Telescope National Facility, CSIRO
                    PO Box 76
                    Epping NSW 1710
                    AUSTRALIA

  Author: Mark Calabretta, Australia Telescope National Facility
  http://www.atnf.csiro.au/~mcalabre/index.html
  $Id: pgwcsl.c,v 4.12.1.1 2012/02/29 07:59:11 cal103 Exp cal103 $
@


4.13.1.1
log
@WCSLIB 4.13 development branch.
@
text
@d31 1
a31 1
  $Id: pgwcsl.c,v 4.13 2012/03/14 07:39:31 cal103 Exp $
@


4.13.1.2
log
@Changed contact details.
@
text
@d19 1
a19 1
  along with PGSBOX.  If not, see http://www.gnu.org/licenses.
d21 11
a31 5
  Direct correspondence concerning PGSBOX to mark@@calabretta.id.au

  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
  http://www.atnf.csiro.au/people/Mark.Calabretta
  $Id: pgwcsl.c,v 4.13.1.1 2012/03/14 07:40:39 cal103 Exp cal103 $
@


4.12
log
@WCSLIB 4.12
@
text
@d3 1
a3 1
  PGSBOX 4.12 - draw curvilinear coordinate axes for PGPLOT.
d31 1
a31 1
  $Id: pgwcsl.c,v 4.11.1.1 2012/02/20 23:31:14 cal103 Exp cal103 $
@


4.12.1.1
log
@WCSLIB 4.12 development branch.
@
text
@d31 1
a31 1
  $Id: pgwcsl.c,v 4.12 2012/02/29 07:57:57 cal103 Exp $
@


4.11
log
@WCSLIB 4.11
@
text
@d3 1
a3 1
  PGSBOX 4.11 - draw curvilinear coordinate axes for PGPLOT.
d31 1
a31 1
  $Id: pgwcsl.c,v 4.10.1.1 2012/02/05 23:42:47 cal103 Exp cal103 $
@


4.11.1.1
log
@WCSLIB 4.11 development branch.
@
text
@d31 1
a31 1
  $Id: pgwcsl.c,v 4.11 2012/02/20 23:30:03 cal103 Exp $
@


4.10
log
@WCSLIB 4.10
@
text
@d3 1
a3 1
  PGSBOX 4.10 - draw curvilinear coordinate axes for PGPLOT.
d31 1
a31 1
  $Id: pgwcsl.c,v 4.9.1.1 2012/01/24 05:41:46 cal103 Exp cal103 $
@


4.10.1.1
log
@WCSLIB 4.10 development branch.
@
text
@d31 1
a31 1
  $Id: pgwcsl.c,v 4.10 2012/02/05 23:41:45 cal103 Exp $
@


4.9
log
@WCSLIB 4.9
@
text
@d3 1
a3 1
  PGSBOX 4.9 - draw curvilinear coordinate axes for PGPLOT.
d31 1
a31 1
  $Id: pgwcsl.c,v 4.8.1.2 2012/01/24 05:24:50 cal103 Exp cal103 $
@


4.9.1.1
log
@WCSLIB 4.9 development branch.
@
text
@d31 1
a31 1
  $Id: pgwcsl.c,v 4.9 2012/01/24 05:40:30 cal103 Exp $
@


4.8
log
@WCSLIB 4.8
@
text
@d3 2
a4 2
  PGSBOX 4.8 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2011, Mark Calabretta
d31 1
a31 1
  $Id: pgwcsl.c,v 4.7.1.1 2011/02/07 07:04:23 cal103 Exp cal103 $
@


4.8.1.1
log
@WCSLIB 4.8 development branch.
@
text
@d31 1
a31 1
  $Id: pgwcsl.c,v 4.8 2011/08/15 08:05:55 cal103 Exp $
@


4.8.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2012, Mark Calabretta
d31 1
a31 1
  $Id: pgwcsl.c,v 4.8.1.1 2011/08/15 08:07:07 cal103 Exp cal103 $
@


4.7
log
@WCSLIB 4.7
@
text
@d3 1
a3 1
  PGSBOX 4.7 - draw curvilinear coordinate axes for PGPLOT.
d31 1
a31 1
  $Id: pgwcsl.c,v 4.6.1.3 2011/01/18 06:13:50 cal103 Exp cal103 $
@


4.7.1.1
log
@WCSLIB 4.7 development branch.
@
text
@d31 1
a31 1
  $Id: pgwcsl.c,v 4.7 2011/02/07 07:03:43 cal103 Exp $
@


4.6
log
@WCSLIB 4.6
@
text
@d3 2
a4 2
  PGSBOX 4.6 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2010, Mark Calabretta
d31 1
a31 1
  $Id: pgwcsl.c,v 4.5.1.1 2010/07/16 07:05:33 cal103 Exp cal103 $
d253 1
a253 1
   }
d255 1
a255 1
   return;
@


4.6.1.1
log
@WCSLIB 4.6 development branch.
@
text
@d31 1
a31 1
  $Id: pgwcsl.c,v 4.6 2010/11/16 06:15:32 cal103 Exp $
@


4.6.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2011, Mark Calabretta
d31 1
a31 1
  $Id: pgwcsl.c,v 4.6.1.1 2010/11/16 06:16:20 cal103 Exp cal103 $
@


4.6.1.3
log
@Trivial fix to indentation.
@
text
@d31 1
a31 1
  $Id: pgwcsl.c,v 4.6.1.2 2011/01/14 06:35:20 cal103 Exp cal103 $
d253 1
a253 1
  }
d255 1
a255 1
  return;
@


4.5
log
@WCSLIB 4.5
@
text
@d3 1
a3 1
  PGSBOX 4.5 - draw curvilinear coordinate axes for PGPLOT.
d31 1
a31 1
  $Id: pgwcsl.c,v 4.4.1.2 2010/01/19 03:45:24 cal103 Exp cal103 $
@


4.5.1.1
log
@WCSLIB 4.5 development branch.
@
text
@d31 1
a31 1
  $Id: pgwcsl.c,v 4.5 2010/07/16 07:01:27 cal103 Exp $
@


4.4
log
@WCSLIB 4.4
@
text
@d3 2
a4 2
  PGSBOX 4.4 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2009, Mark Calabretta
d31 1
a31 1
  $Id: pgwcsl.c,v 4.3.1.2 2009/07/23 04:17:17 cal103 Exp cal103 $
@


4.4.1.1
log
@WCSLIB 4.4 development branch.
@
text
@d31 1
a31 1
  $Id: pgwcsl.c,v 4.4 2009/08/06 07:54:40 cal103 Exp $
@


4.4.1.2
log
@Updated date in copyright notice.
@
text
@d4 1
a4 1
  Copyright (C) 1997-2010, Mark Calabretta
d31 1
a31 1
  $Id: pgwcsl.c,v 4.4.1.1 2009/08/10 08:55:45 cal103 Exp cal103 $
@


4.3
log
@PGSBOX 4.3
@
text
@d3 2
a4 2
    PGSBOX 4.3 - an implementation of the FITS WCS standard.
    Copyright (C) 1997-2007, Mark Calabretta
d6 1
a6 1
    This file is part of PGSBOX.
d8 24
a31 24
    PGSBOX is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License as published by the
    Free Software Foundation, either version 3 of the License, or (at your
    option) any later version.

    PGSBOX is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
    more details.

    You should have received a copy of the GNU Lesser General Public License
    along with PGSBOX.  If not, see <http://www.gnu.org/licenses/>.

    Correspondence concerning PGSBOX may be directed to:
       Internet email: mcalabre@@atnf.csiro.au
       Postal address: Dr. Mark Calabretta
                       Australia Telescope National Facility, CSIRO
                       PO Box 76
                       Epping NSW 1710
                       AUSTRALIA

    Author: Mark Calabretta, Australia Telescope National Facility
    http://www.atnf.csiro.au/~mcalabre/index.html
    $Id: pgwcsl.c,v 4.2.1.4 2007/12/22 04:01:45 cal103 Exp cal103 $
d57 32
a88 20
   int i, outside, stat;
   double dp, imgcrd[9], lat, lng, ph, phi, sdummy, th, theta;
   static double wrld[9];
   struct wcsprm *wcsp;
   struct celprm *wcscel;

   *ierr = 0;

   wcsp = (struct wcsprm *)wcs;
   wcscel = &(wcsp->cel);

   if (*opcode == 2) {
      /* Compute pixel coordinates from world coordinates. */
      if (wcsp->lng < 0) {
         /* Simple linear coordinates. */
         if (wcss2p(wcsp, 1, 0, world, &phi, &theta, imgcrd, pixel, &stat)) {
            *ierr = 1;
         }
         return;
      }
d90 61
a150 11
      wrld[wcsp->lng] = world[0];
      if (world[1] > 90.0) {
         wrld[wcsp->lat] = 90.0;
         outside = -2;
      } else if (world[1] < -90.0) {
         wrld[wcsp->lat] = -90.0;
         outside = -2;
      } else {
         wrld[wcsp->lat] = world[1];
         outside = 0;
      }
d152 1
a152 72
      if (*contrl == 0) {
         if (wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd, pixel, &stat)) {
            /* Translate status return values. */
            *ierr = stat ? 2 : 1;
            return;
         }

         if (fabs(phi-contxt[2]) > 180.0) {
            /* Hit a discontinuity at phi = +/- 180. */
            contxt[4] = pixel[0];
            contxt[5] = pixel[1];

            if (contxt[2] > phi) {
               ph = 179.9999;
               dp = (phi - contxt[2]) + 360.0;
            } else {
               ph = -179.9999;
               dp = (phi - contxt[2]) - 360.0;
            }

            /* First approximation for theta. */
            if (dp == 0.0) {
               th = contxt[3];
            } else {
               th = contxt[3] + (ph-contxt[2])*(theta-contxt[3])/dp;
            }

            /* Iterate once to refine the value of theta. */
            sphx2s(wcscel->euler, 1, 1, 1, 1, &ph, &th, &lng, &lat);
            if (wrld[wcsp->lng] == contxt[0]) {
               /* We are following a meridian of longitude. */
               lng = wrld[wcsp->lng];
            } else {
               /* We are following a parallel of latitude. */
               lat = wrld[wcsp->lat];
            }
            sphs2x(wcscel->euler, 1, 1, 1, 1, &lng, &lat, &sdummy, &th);

            contxt[0] = wrld[wcsp->lng];
            contxt[1] = wrld[wcsp->lat];
            contxt[2] = phi;
            contxt[3] = theta;

            /* Pixel coordinates crossing into the discontinuity. */
            sphx2s(wcscel->euler, 1, 1, 1, 1, &ph, &th, wrld+wcsp->lng,
               wrld+wcsp->lat);
            if (wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd, pixel,
               &stat)) {
               /* Translate status return values. */
               *ierr = stat ? 2 : 1;
               return;
            }

            /* Pixel coordinates crossing out of the discontinuity. */
            ph *= -1.0;
            sphx2s(wcscel->euler, 1, 1, 1, 1, &ph, &th, wrld+wcsp->lng,
               wrld+wcsp->lat);
            if (wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd, contxt+6,
               &stat)) {
               /* Translate status return values. */
               *ierr = stat ? 2 : 1;
               return;
            }

            *contrl = 1;
         } else {
            /* Normal mode, no discontinuity. */
            contxt[0] = wrld[wcsp->lng];
            contxt[1] = wrld[wcsp->lat];
            contxt[2] = phi;
            contxt[3] = theta;
         }
d154 12
a165 32
         if (*contrl == 1) {
            /* Move to the other side of the discontinuity. */
            pixel[0] = contxt[6];
            pixel[1] = contxt[7];
            *contrl = 2;
         } else {
            /* Complete the traversal. */
            pixel[0] = contxt[4];
            pixel[1] = contxt[5];
            *contrl = 0;
         }
      }

      *ierr = outside;

   } else if (*opcode == 1) {
      /* Compute pixel coordinates from world coordinates. */
      if (wcsp->lng < 0) {
         /* Simple linear coordinates. */
         if (wcss2p(wcsp, 1, 0, world, &phi, &theta, imgcrd, pixel, &stat)) {
            *ierr = 1;
         }
         return;
      }

      wrld[wcsp->lng] = world[0];
      if (world[1] > 90.0) {
         wrld[wcsp->lat] = 90.0;
         outside = -2;
      } else if (world[1] < -90.0) {
         wrld[wcsp->lat] = -90.0;
         outside = -2;
d167 50
a216 23
         wrld[wcsp->lat] = world[1];
         outside = 0;
      }

      if (wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd, pixel, &stat)) {
         /* Translate status return values. */
         *ierr = stat ? 2 : 1;
         return;
      }

      contxt[0] = wrld[wcsp->lng];
      contxt[1] = wrld[wcsp->lat];
      contxt[2] = phi;
      contxt[3] = theta;

      *ierr = outside;

   } else if (*opcode == 0) {
      /* Initialize. */
      if (*nli < WCSLEN) {
         *ierr = 1;
         return;
      }
d218 30
a247 2
      if ((*ierr = wcsset(wcsp))) {
         *ierr = *ierr <= 2 ? 1 : 2;
d249 1
d251 2
a252 31
      for (i = 2; i < 9; i++) {
         wrld[i] = 0.0;
      }

      *contrl = 0;

   } else if (*opcode == -1) {
      /* Compute world coordinates from pixel coordinates. */
      if (wcsp2s(wcsp, 1, 0, pixel, imgcrd, &phi, &theta, wrld, &stat)) {
         /* Translate status return values. */
         *ierr = stat ? 3 : 1;
         return;
      }

      if (wcsp->lng < 0) {
         /* Simple linear coordinates. */
         world[0] = wrld[0];
         world[1] = wrld[1];
      } else {
         world[0] = wrld[wcsp->lng];
         world[1] = wrld[wcsp->lat];

         if (phi < -180.0 || phi > 180.0) {
            /* Pixel is outside the principle range of native longitude. */
            *ierr = 3;
            return;
         }
      }

   } else {
      *ierr = 1;
@


4.3.1.1
log
@PGSBOX 4.3 development branch.
@
text
@d3 2
a4 2
    PGSBOX 4.4 - an implementation of the FITS WCS standard.
    Copyright (C) 1997-2008, Mark Calabretta
d31 1
a31 1
    $Id: pgwcsl.c,v 4.3 2007/12/27 05:49:14 cal103 Exp cal103 $
@


4.3.1.2
log
@Changed indentation.
@
text
@d3 2
a4 2
  PGSBOX 4.4 - draw curvilinear coordinate axes for PGPLOT.
  Copyright (C) 1997-2009, Mark Calabretta
d6 1
a6 1
  This file is part of PGSBOX.
d8 24
a31 24
  PGSBOX is free software: you can redistribute it and/or modify it under the
  terms of the GNU Lesser General Public License as published by the Free
  Software Foundation, either version 3 of the License, or (at your option)
  any later version.

  PGSBOX is distributed in the hope that it will be useful, but WITHOUT ANY
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
  more details.

  You should have received a copy of the GNU Lesser General Public License
  along with PGSBOX.  If not, see <http://www.gnu.org/licenses/>.

  Correspondence concerning PGSBOX may be directed to:
    Internet email: mcalabre@@atnf.csiro.au
    Postal address: Dr. Mark Calabretta
                    Australia Telescope National Facility, CSIRO
                    PO Box 76
                    Epping NSW 1710
                    AUSTRALIA

  Author: Mark Calabretta, Australia Telescope National Facility
  http://www.atnf.csiro.au/~mcalabre/index.html
  $Id: pgwcsl.c,v 4.3.1.1 2007/12/27 13:26:31 cal103 Exp cal103 $
d57 142
a198 32
  int i, outside, stat;
  double dp, imgcrd[9], lat, lng, ph, phi, sdummy, th, theta;
  static double wrld[9];
  struct wcsprm *wcsp;
  struct celprm *wcscel;

  *ierr = 0;

  wcsp = (struct wcsprm *)wcs;
  wcscel = &(wcsp->cel);

  if (*opcode == 2) {
    /* Compute pixel coordinates from world coordinates. */
    if (wcsp->lng < 0) {
      /* Simple linear coordinates. */
      if (wcss2p(wcsp, 1, 0, world, &phi, &theta, imgcrd, pixel, &stat)) {
        *ierr = 1;
      }
      return;
    }

    wrld[wcsp->lng] = world[0];
    if (world[1] > 90.0) {
      wrld[wcsp->lat] = 90.0;
      outside = -2;
    } else if (world[1] < -90.0) {
      wrld[wcsp->lat] = -90.0;
      outside = -2;
    } else {
      wrld[wcsp->lat] = world[1];
      outside = 0;
    }
a199 1
    if (*contrl == 0) {
d201 26
a226 59
        /* Translate status return values. */
        *ierr = stat ? 2 : 1;
        return;
      }

      if (fabs(phi-contxt[2]) > 180.0) {
        /* Hit a discontinuity at phi = +/- 180. */
        contxt[4] = pixel[0];
        contxt[5] = pixel[1];

        if (contxt[2] > phi) {
          ph = 179.9999;
          dp = (phi - contxt[2]) + 360.0;
        } else {
          ph = -179.9999;
          dp = (phi - contxt[2]) - 360.0;
        }

        /* First approximation for theta. */
        if (dp == 0.0) {
          th = contxt[3];
        } else {
          th = contxt[3] + (ph-contxt[2])*(theta-contxt[3])/dp;
        }

        /* Iterate once to refine the value of theta. */
        sphx2s(wcscel->euler, 1, 1, 1, 1, &ph, &th, &lng, &lat);
        if (wrld[wcsp->lng] == contxt[0]) {
          /* We are following a meridian of longitude. */
          lng = wrld[wcsp->lng];
        } else {
          /* We are following a parallel of latitude. */
          lat = wrld[wcsp->lat];
        }
        sphs2x(wcscel->euler, 1, 1, 1, 1, &lng, &lat, &sdummy, &th);

        contxt[0] = wrld[wcsp->lng];
        contxt[1] = wrld[wcsp->lat];
        contxt[2] = phi;
        contxt[3] = theta;

        /* Pixel coordinates crossing into the discontinuity. */
        sphx2s(wcscel->euler, 1, 1, 1, 1, &ph, &th, wrld+wcsp->lng,
          wrld+wcsp->lat);
        if (wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd, pixel, &stat)) {
          /* Translate status return values. */
          *ierr = stat ? 2 : 1;
          return;
        }

        /* Pixel coordinates crossing out of the discontinuity. */
        ph *= -1.0;
        sphx2s(wcscel->euler, 1, 1, 1, 1, &ph, &th, wrld+wcsp->lng,
          wrld+wcsp->lat);
        if (wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd, contxt+6, &stat)) {
          /* Translate status return values. */
          *ierr = stat ? 2 : 1;
          return;
        }
d228 14
a241 1
        *contrl = 1;
d243 2
a244 63
        /* Normal mode, no discontinuity. */
        contxt[0] = wrld[wcsp->lng];
        contxt[1] = wrld[wcsp->lat];
        contxt[2] = phi;
        contxt[3] = theta;
      }
    } else {
      if (*contrl == 1) {
        /* Move to the other side of the discontinuity. */
        pixel[0] = contxt[6];
        pixel[1] = contxt[7];
        *contrl = 2;
      } else {
        /* Complete the traversal. */
        pixel[0] = contxt[4];
        pixel[1] = contxt[5];
        *contrl = 0;
      }
    }

    *ierr = outside;

  } else if (*opcode == 1) {
    /* Compute pixel coordinates from world coordinates. */
    if (wcsp->lng < 0) {
      /* Simple linear coordinates. */
      if (wcss2p(wcsp, 1, 0, world, &phi, &theta, imgcrd, pixel, &stat)) {
        *ierr = 1;
      }
      return;
    }

    wrld[wcsp->lng] = world[0];
    if (world[1] > 90.0) {
      wrld[wcsp->lat] = 90.0;
      outside = -2;
    } else if (world[1] < -90.0) {
      wrld[wcsp->lat] = -90.0;
      outside = -2;
    } else {
      wrld[wcsp->lat] = world[1];
      outside = 0;
    }

    if (wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd, pixel, &stat)) {
      /* Translate status return values. */
      *ierr = stat ? 2 : 1;
      return;
    }

    contxt[0] = wrld[wcsp->lng];
    contxt[1] = wrld[wcsp->lat];
    contxt[2] = phi;
    contxt[3] = theta;

    *ierr = outside;

  } else if (*opcode == 0) {
    /* Initialize. */
    if (*nli < WCSLEN) {
      *ierr = 1;
      return;
    }
d246 5
a250 30
    if ((*ierr = wcsset(wcsp))) {
      *ierr = *ierr <= 2 ? 1 : 2;
    }

    for (i = 2; i < 9; i++) {
      wrld[i] = 0.0;
    }

    *contrl = 0;

  } else if (*opcode == -1) {
    /* Compute world coordinates from pixel coordinates. */
    if (wcsp2s(wcsp, 1, 0, pixel, imgcrd, &phi, &theta, wrld, &stat)) {
      /* Translate status return values. */
      *ierr = stat ? 3 : 1;
      return;
    }

    if (wcsp->lng < 0) {
      /* Simple linear coordinates. */
      world[0] = wrld[0];
      world[1] = wrld[1];
    } else {
      world[0] = wrld[wcsp->lng];
      world[1] = wrld[wcsp->lat];

      if (phi < -180.0 || phi > 180.0) {
        /* Pixel is outside the principle range of native longitude. */
        *ierr = 3;
        return;
a251 1
    }
d253 2
a254 2
  } else {
    *ierr = 1;
@


4.2
log
@PGSBOX 4.2
@
text
@d2 30
a31 29
*
*   PGSBOX 4.2 - a non-linear coordinate axis plotter for PGPLOT.
*   Copyright (C) 1997-2005, Mark Calabretta
*
*   PGSBOX is free software; you can redistribute it and/or modify it under
*   the terms of the GNU General Public License as published by the Free
*   Software Foundation; either version 2 of the License, or (at your option)
*   any later version.
*
*   PGSBOX is distributed in the hope that it will be useful, but WITHOUT ANY
*   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
*   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
*   details.
*
*   You should have received a copy of the GNU General Public License along
*   with PGSBOX; if not, write to the Free Software Foundation, Inc.,
*   59 Temple Place, Suite 330, Boston, MA  02111-1307, USA
*
*   Correspondence concerning WCSLIB may be directed to:
*      Internet email: mcalabre@@atnf.csiro.au
*      Postal address: Dr. Mark Calabretta
*                      Australia Telescope National Facility, CSIRO
*                      PO Box 76
*                      Epping NSW 1710
*                      AUSTRALIA
*
*   Author: Mark Calabretta, Australia Telescope National Facility
*   http://www.atnf.csiro.au/~mcalabre/index.html
*   $Id: pgwcsl.c,v 4.1 2005/08/19 14:09:53 cal103 Exp cal103 $
d39 4
d220 1
a220 1
      if (*ierr = wcsset(wcsp)) {
@


4.2.1.1
log
@PGSBOX 4.2 development branch.
@
text
@d3 1
a3 1
*   PGSBOX 4.3 - a non-linear coordinate axis plotter for PGPLOT.
d30 1
a30 1
*   $Id: pgwcsl.c,v 4.2 2005/09/21 13:27:15 cal103 Exp cal103 $
@


4.2.1.2
log
@Parenthesised assignments used as truth values.
@
text
@d4 1
a4 1
*   Copyright (C) 1997-2007, Mark Calabretta
d30 1
a30 1
*   $Id: pgwcsl.c,v 4.2.1.1 2005/12/05 03:23:34 cal103 Exp cal103 $
d215 1
a215 1
      if ((*ierr = wcsset(wcsp))) {
@


4.2.1.3
log
@Switched to LGPL 3.0.
@
text
@d2 29
a30 30

    PGSBOX 4.3 - an implementation of the FITS WCS standard.
    Copyright (C) 1997-2007, Mark Calabretta

    This file is part of PGSBOX.

    PGSBOX is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License as published by the
    Free Software Foundation, either version 3 of the License, or (at your
    option) any later version.

    PGSBOX is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
    more details.

    You should have received a copy of the GNU Lesser General Public License
    along with PGSBOX.  If not, see <http://www.gnu.org/licenses/>.

    Correspondence concerning PGSBOX may be directed to:
       Internet email: mcalabre@@atnf.csiro.au
       Postal address: Dr. Mark Calabretta
                       Australia Telescope National Facility, CSIRO
                       PO Box 76
                       Epping NSW 1710
                       AUSTRALIA

    Author: Mark Calabretta, Australia Telescope National Facility
    http://www.atnf.csiro.au/~mcalabre/index.html
    $Id: pgwcsl.c,v 4.2.1.2 2007/06/29 06:47:31 cal103 Exp cal103 $
@


4.2.1.4
log
@Do Fortran name mangling using the F77_FUNC(name, NAME) macro defined in
wcsconfig_f77.h by 'configure'.
@
text
@d31 1
a31 1
    $Id: pgwcsl.c,v 4.2.1.3 2007/12/03 05:41:29 cal103 Exp cal103 $
a38 4
/* Fortran name mangling. */
#include <wcsconfig_f77.h>
#define pgwcsl_ F77_FUNC(pgwcsl, PGWCSL)

@


4.1
log
@PGSBOX 4.1: tidy the code up a little by defining and using
struct celprm *wcscel.
@
text
@d3 1
a3 1
*   PGSBOX 4.1 - a non-linear coordinate axis plotter for PGPLOT.
d30 1
a30 1
*   $Id: pgwcsl.c,v 4.0 2005/02/04 12:24:01 cal103 Exp $
@


4.0
log
@PGSBOX 4.0: changed from LGPL to GPL; rationalized the handling of error
return codes from WCSLIB.
@
text
@d3 1
a3 1
*   PGSBOX 4.0 - a non-linear coordinate axis plotter for PGPLOT.
d30 1
a30 1
*   $Id: pgwcsl.c,v 3.6 2004/08/24 08:40:40 cal103 Exp cal103 $
d56 1
d61 1
d69 1
a69 1
	 }
d113 1
a113 1
            sphx2s(wcsp->cel.euler, 1, 1, 1, 1, &ph, &th, &lng, &lat);
d121 1
a121 1
            sphs2x(wcsp->cel.euler, 1, 1, 1, 1, &lng, &lat, &sdummy, &th);
d129 1
a129 1
            sphx2s(wcsp->cel.euler, 1, 1, 1, 1, &ph, &th, wrld+wcsp->lng,
d140 1
a140 1
            sphx2s(wcsp->cel.euler, 1, 1, 1, 1, &ph, &th, wrld+wcsp->lng,
d179 1
a179 1
	 }
@


3.6
log
@PGSBOX 3.6: "error status/code/number" is now referred to consistently as the
"status return value".
@
text
@d3 2
a4 2
*   PGSBOX 3.6 - a non-linear coordinate axis plotter for PGPLOT.
*   Copyright (C) 1997-2004, Mark Calabretta
d6 4
a9 4
*   This library is free software; you can redistribute it and/or modify it
*   under the terms of the GNU Library General Public License as published
*   by the Free Software Foundation; either version 2 of the License, or (at
*   your option) any later version.
d11 4
a14 4
*   This library is distributed in the hope that it will be useful, but
*   WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
*   General Public License for more details.
d16 3
a18 3
*   You should have received a copy of the GNU Library General Public License
*   along with this library; if not, write to the Free Software Foundation,
*   Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
d30 1
a30 1
*   $Id: pgwcsl.c,v 3.5 2004/06/28 05:38:20 mcalabre Exp mcalabre $
d65 3
a67 2
         if (*ierr = wcss2p(wcsp, 1, 0, world, &phi, &theta, imgcrd, pixel,
            &stat)) *ierr = 1;
d84 1
a84 2
         if (*ierr = wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd, pixel,
            &stat)) {
d111 1
a111 2
            *ierr = sphx2s(wcsp->cel.euler, 1, 1, 1, 1, &ph, &th, &lng,
               &lat);
d119 1
a119 2
            *ierr = sphs2x(wcsp->cel.euler, 1, 1, 1, 1, &lng, &lat, &sdummy,
                           &th);
d127 3
a129 3
            *ierr = sphx2s(wcsp->cel.euler, 1, 1, 1, 1, &ph, &th,
               wrld+wcsp->lng, wrld+wcsp->lat);
            if (*ierr = wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd, pixel,
d138 4
a141 4
            *ierr = sphx2s(wcsp->cel.euler, 1, 1, 1, 1, &ph, &th,
               wrld+wcsp->lng, wrld+wcsp->lat);
            if (*ierr = wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd,
               contxt+6, &stat)) {
d175 3
a177 2
         if (*ierr = wcss2p(wcsp, 1, 0, world, &phi, &theta, imgcrd,
            pixel, &stat)) *ierr = 1;
d193 1
a193 2
      if (*ierr = wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd, pixel,
         &stat)) {
d213 3
a215 1
      *ierr = wcsset(wcsp);
d225 1
a225 2
      if (*ierr = wcsp2s(wcsp, 1, 0, pixel, imgcrd, &phi, &theta, wrld,
         &stat)) {
@


3.5
log
@PGSBOX 3.5: changed variables world and pixel from (double [2]) to (double *)
to allow extra elements, and resized imgcrd and wrld from (double [2]) to
(double [9]) to accomodate higher-dimensional coordinate representations of
up to 9 elements. The assumption (presently) is that the first two world, and
pixel, coordinate elements are the relevant ones; the others are all set to
zero when pgwcsl() initializes and otherwise ignored.
@
text
@d3 1
a3 1
*   PGSBOX 3.5 - a non-linear coordinate axis plotter for PGPLOT.
d30 1
a30 1
*   $Id: pgwcsl.c,v 3.4 2004/02/10 23:56:37 mcalabre Exp mcalabre $
d85 1
a85 1
            /* Translate error codes. */
d133 1
a133 1
               /* Translate error codes. */
d144 1
a144 1
               /* Translate error codes. */
d196 1
a196 1
         /* Translate error codes. */
d227 1
a227 1
         /* Translate error codes. */
@


3.4
log
@PGSBOX 3.4
@
text
@d3 1
a3 1
*   PGSBOX 3.4 - a non-linear coordinate axis plotter for PGPLOT.
d29 2
a30 1
*   $Id: pgwcsl.c,v 3.3 2003/10/22 08:45:00 mcalabre Exp mcalabre $
d45 2
a46 2
double world[2];
double pixel[2];
d52 3
a54 2
   int outside, stat;
   double dp, imgcrd[2], lat, lng, ph, phi, sdummy, th, theta, wrld[2];
d216 4
@


3.3
log
@PGSBOX 3.3: moved prologue comments to pgwcsl.h; return error -2 if the
latitude is outside -90 to +90 for opcodes +2 and +1; amended the translation
of status return codes from WCSLIB.
@
text
@d3 2
a4 2
*   PGSBOX 3.3 - a non-linear coordinate axis plotter for PGPLOT.
*   Copyright (C) 1997-2003, Mark Calabretta
d29 1
a29 1
*   $Id: pgwcsl.c,v 3.2 2003/09/09 08:04:14 mcalabre Exp mcalabre $
@


3.2
log
@PGSBOX 3.2
@
text
@d3 1
a3 1
*   PGSBOX 3.2 - a non-linear coordinate axis plotter for PGPLOT.
a27 85
*=============================================================================
*
*   pgwcsl_() is an NLFUNC for PGSBOX that defines curvilinear celestial
*   coordinate systems by interfacing to WCSLIB 3.x.
*
*   Since WCSLIB 3.x is a C library, pgwcsl_() is written in C.  However, as
*   PGSBOX expects NLFUNC to be a FORTRAN subroutine, its interfaces
*   necessarily emulate those of a FORTRAN subroutine.  Hence the trailing
*   underscore in the name of the function and the pointer (reference)
*   argument list.
*
*   The wcsprm struct on which WCSLIB 3.x is based is passed as an integer
*   array of size WCSLEN at least (WCSLEN is defined in wcs.h).  While the
*   contents of this array are not interpretable in FORTRAN, it may be
*   constructed and interrogated by service routines (WCSPUT and WCSGET)
*   provided with the FORTRAN wrappers for WCSLIB 3.x.  The array is cast to
*   (struct wcsprm *) for use here and in WCSLIB.
*
*   Given:
*      opcode   int*     Transformation code:
*                            2: Compute a set of pixel coordinates which
*                               describe a path between this and the previous
*                               pair of world coordinates remembered from the
*                               last call with opcode == 1 || 2.
*                            1: Compute pixel coordinates from world
*                               coordinates.
*                            0: Initialize.
*                           -1: Compute world coordinates from pixel
*                               coordinates.
*
*      nlc      int*     Number of elements in nlcprm[] (not used).
*
*      nli      int*     Number of elements in wcs (at least WCSLEN).
*
*      nld      int*     Number of elements in nldprm (not used).
*
*      nlcprm   char[nlc]
*                        Character array (not used).
*
*   Given and/or returned:
*      wcs      int[nli] Integer array which contains the wcsprm struct (see
*                        below).
*
*      nldprm   double[nld]
*                        Double precision array (not used).
*
*      world    double[2]
*                        World coordinates.  world[0] and world[1] are the
*                        longitude and latitude, in degrees.  Given if
*                        opcode > 0, returned if opcode < 0.
*
*      pixel    double[2]
*                        Pixel coordinates.  Given if opcode < 0, returned if
*                        opcode > 0.
*
*      contrl   int*     Control flag for opcode == 2:
*                           0: Normal state
*                           1: A discontinuity has been encountered; force
*                              PGSBOX to flush its plotting buffer and call
*                              pgwcsl_() again with the same world
*                              coordinates.
*                           2: Call pgwcsl_() again with the same world
*                              coordinates.
*
*      contxt   double[20]
*                        Context elements for opcode == 2.
*
*   Returned:
*      ierr     int*     Error status
*                           0: Success.
*                           1: Invalid parameters.
*                           2: Invalid world coordinate.
*                           3: Invalid pixel coordinate.
*
*   Notes
*   -----
*    1) pgwcsl_() assumes a simple 2-D image.
*
*    2) The wcsprm struct (contained in the wcs[] array) is maintained by
*       pgwcsl_() and WCSLIB and must not be disturbed by the caller after
*       initialization with opcode == 0.
*
*    3) pgwcsl_() doesn't properly handle discontinuities between the faces
*       of the quadcube projections.
*
d29 1
a29 1
*   $Id: pgwcsl.c,v 3.1 2003/04/28 05:24:34 mcalabre Exp mcalabre $
d51 1
a51 1
   int stat;
d71 1
d74 1
d77 1
d84 1
a84 7
            if (*ierr == 2) {
               *ierr = 1;
            } else if (*ierr == 3) {
               *ierr = 2;
            } else if (*ierr == 4) {
               *ierr = 1;
            }
d132 1
a132 7
               if (*ierr == 2) {
                  *ierr = 1;
               } else if (*ierr == 3) {
                  *ierr = 2;
               } else if (*ierr == 4) {
                  *ierr = 1;
               }
d143 1
a143 7
               if (*ierr == 2) {
                  *ierr = 1;
               } else if (*ierr == 3) {
                  *ierr = 2;
               } else if (*ierr == 4) {
                  *ierr = 1;
               }
d169 2
d175 1
a175 1
         if (*ierr = wcss2p(wcsp, 1, 0, wrld, &phi, &theta, imgcrd,
d183 1
d186 1
d189 1
d195 1
a195 5
         if (*ierr == 2 || *ierr == 4) {
            *ierr = 1;
         } else if (*ierr == 3) {
            *ierr = 2;
         }
d204 2
d222 1
a222 1
         if (*ierr == 2 || *ierr == 4) *ierr = 1;
@


3.1
log
@PGSBOX 3.1
@
text
@d3 1
a3 1
*   PGSBOX - a non-linear coordinate axis plotter for PGPLOT.
d114 1
a114 1
*   $Id: pgwcsl.f,v 1.16 2002/11/20 00:31:33 mcalabre Exp $
@
