<commit_before>/* $Id$

	Coordinate transformation routines.
*/

#include "plplot/plplotP.h"

/*--------------------------------------------------------------------------*\
 * Transformations returning physical coordinates.
\*--------------------------------------------------------------------------*/

/* device coords to physical coords (x) */

PLINT
plP_dcpcx(PLFLT x)
{
    return (ROUND(plsc->phyxmi + plsc->phyxlen * x));
}

/* device coords to physical coords (y) */

PLINT
plP_dcpcy(PLFLT y)
{
    return (ROUND(plsc->phyymi + plsc->phyylen * y));
}

/* millimeters from bottom left-hand corner to physical coords (x) */

PLINT
plP_mmpcx(PLFLT x)
{
    return (ROUND(plsc->phyxmi + plsc->xpmm * x));
}

/* millimeters from bottom left-hand corner to physical coords (y) */

PLINT
plP_mmpcy(PLFLT y)
{
    return (ROUND(plsc->phyymi + plsc->ypmm * y));
}

/* world coords to physical coords (x) */

PLINT
plP_wcpcx(PLFLT x)
{
    return (ROUND(plsc->wpxoff + plsc->wpxscl * x));
}

/* world coords to physical coords (y) */

PLINT
plP_wcpcy(PLFLT y)
{
    return (ROUND(plsc->wpyoff + plsc->wpyscl * y));
}

/*--------------------------------------------------------------------------*\
 * Transformations returning device coordinates.
\*--------------------------------------------------------------------------*/

/* physical coords to device coords (x) */

PLFLT
plP_pcdcx(PLINT x)
{
    return (PLFLT) ((x - plsc->phyxmi) / (double) plsc->phyxlen);
}

/* physical coords to device coords (y) */

PLFLT
plP_pcdcy(PLINT y)
{
    return (PLFLT) ((y - plsc->phyymi) / (double) plsc->phyylen);
}

/* millimeters from bottom left corner to device coords (x) */

PLFLT
plP_mmdcx(PLFLT x)
{
    return ((PLFLT) (x * plsc->xpmm / ABS(plsc->phyxma - plsc->phyxmi)));
}

/* millimeters from bottom left corner to device coords (y) */

PLFLT
plP_mmdcy(PLFLT y)
{
    return ((PLFLT) (y * plsc->ypmm / ABS(plsc->phyyma - plsc->phyymi)));<commit_msg>Implemented new transformers, plP_wcdcx and plP_wcdcy (world coords to normalized device coords).<commit_after>/* $Id$

	Coordinate transformation routines.
*/

#include "plplot/plplotP.h"

/*--------------------------------------------------------------------------*\
 * Transformations returning physical coordinates.
\*--------------------------------------------------------------------------*/

/* device coords to physical coords (x) */

PLINT
plP_dcpcx(PLFLT x)
{
    return (ROUND(plsc->phyxmi + plsc->phyxlen * x));
}

/* device coords to physical coords (y) */

PLINT
plP_dcpcy(PLFLT y)
{
    return (ROUND(plsc->phyymi + plsc->phyylen * y));
}

/* millimeters from bottom left-hand corner to physical coords (x) */

PLINT
plP_mmpcx(PLFLT x)
{
    return (ROUND(plsc->phyxmi + plsc->xpmm * x));
}

/* millimeters from bottom left-hand corner to physical coords (y) */

PLINT
plP_mmpcy(PLFLT y)
{
    return (ROUND(plsc->phyymi + plsc->ypmm * y));
}

/* world coords to physical coords (x) */

PLINT
plP_wcpcx(PLFLT x)
{
    return (ROUND(plsc->wpxoff + plsc->wpxscl * x));
}

/* world coords to physical coords (y) */

PLINT
plP_wcpcy(PLFLT y)
{
    return (ROUND(plsc->wpyoff + plsc->wpyscl * y));
}

/*--------------------------------------------------------------------------*\
 * Transformations returning device coordinates.
\*--------------------------------------------------------------------------*/

/* physical coords to device coords (x) */

PLFLT
plP_pcdcx(PLINT x)
{
    return (PLFLT) ((x - plsc->phyxmi) / (double) plsc->phyxlen);
}

/* physical coords to device coords (y) */

PLFLT
plP_pcdcy(PLINT y)
{
    return (PLFLT) ((y - plsc->phyymi) / (double) plsc->phyylen);
}

/* millimeters from bottom left corner to device coords (x) */

PLFLT
plP_mmdcx(PLFLT x)
{
    return ((PLFLT) (x * plsc->xpmm / ABS(plsc->phyxma - plsc->phyxmi)));
}

/* millimeters from bottom left corner to device coords (y) */

PLFLT
plP_mmdcy(PLFLT y)
{
    return ((PLFLT) (y * plsc->ypmm / ABS(plsc->phyyma - plsc->phyymi)));
}

/* world coords into device coords (x) */

PLFLT
plP_wcdcx(PLFLT x)
{
    return ((PLFLT) (plsc->wdxoff + plsc->wdxscl * x));
}

/* world coords into device coords (y) */

PLFLT
plP_wcdcy(PLFLT y)
{
    return ((PLFLT) (plsc->wdyoff + plsc->wdyscl * y));
{'fraction_non_alphanumeric': 0.2779613025011798, 'fraction_numerical': 0.0, 'mean_word_length': 2.0343593414459558, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5120677', 'n_tokens_mistral': 1563, 'n_tokens_neox': 1541, 'n_words': 368}