<commit_before>var geoOps = {};
geoOps._helper = {};

/* Kinds of geometric elements:
 * P  - Point
 * L  - Line
 * S  - Segment
 * C  - Conic (including circle)
 * *s - Set of *
 * Tr - Projective transformation
 * Mt - Moebius transformation
 * Rc - Reflection in a circle
 * V  - (numeric) value
 * Text - Text
 */


////The RandomLine RandomPoint operators are used by Cinderellas
////Original Mirror Operations

geoOps.RandomLine = {};
geoOps.RandomLine.kind = "L";
geoOps.RandomLine.signature = [];
geoOps.RandomLine.updatePosition = function(el) {
    el.homog = List.realVector([Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5]);
    el.homog = List.normalizeMax(el.homog);
    el.homog = General.withUsage(el.homog, "Line");
};


geoOps.FreeLine = {};
geoOps.FreeLine.kind = "L";
geoOps.FreeLine.signature = [];
geoOps.FreeLine.isMovable = true;
geoOps.FreeLine.initialize = function(el) {
    var pos = geoOps._helper.initializeLine(el);
    putStateComplexVector(pos);
};
geoOps.FreeLine.getParamForInput = function(el, pos, type) {
    var homog;
    if (type === "mouse") {
        homog = List.cross(pos, List.ez);
        homog = List.cross(homog, pos);
    } else if (type === "homog") {
        homog = pos;
    } else {
        homog = List.turnIntoCSList([CSNumber.zero, CSNumber.zero, CSNumber.zero]);
    }
    return List.normalizeMax(homog);
};
geoOps.FreeLine.getParamFromState = function(el) {
    return getStateComplexVector(3);
};
geoOps.FreeLine.putParamToState = function(el, param) {
    putStateComplexVector(param);
};
geoOps.FreeLine.updatePosition = function(el) {
    var param = getStateComplexVector(3);
    putStateComplexVector(param); // copy param
    el.homog = General.withUsage(param, "Line");
};
geoOps.FreeLine.getRandomMove = function(el) {
    var rcomplex = function() {
        var fact = 0.1;
        // only real for debugging REMOVE later
        return CSNumber.complex((Math.random() - 0.5) * fact, (Math.random() - 0.5) * 0);
    };
    var l = el.homog;
    var tt = List.turnIntoCSList([l.value[0], l.value[1], CSNumber.zero]);
    var p = List.turnIntoCSList([rcomplex(), rcomplex(), CSNumber.real(1)]);
    var perp = List.cross(p, tt);

    var move = List.cross(perp, l);
    move = List.normalizeMax(move);

    return {
        type: "homog",
        value: move
    };

};
geoOps.FreeLine.stateSize = 6;


geoOps.RandomPoint = {};
geoOps.RandomPoint.kind = "P";
geoOps.RandomPoint.signature = [];
geoOps.RandomPoint.updatePosition = function(el) {
    el.homog = List.realVector([100 * Math.random(), 100 * Math.random(), 100 * Math.random()]);
    el.homog = List.normalizeMax(el.homog);
    el.homog = General.withUsage(el.homog, "Point");
};<commit_msg>with commit of @kranich the mouse now is rather like a mouse move<commit_after>var geoOps = {};
geoOps._helper = {};

/* Kinds of geometric elements:
 * P  - Point
 * L  - Line
 * S  - Segment
 * C  - Conic (including circle)
 * *s - Set of *
 * Tr - Projective transformation
 * Mt - Moebius transformation
 * Rc - Reflection in a circle
 * V  - (numeric) value
 * Text - Text
 */


////The RandomLine RandomPoint operators are used by Cinderellas
////Original Mirror Operations

geoOps.RandomLine = {};
geoOps.RandomLine.kind = "L";
geoOps.RandomLine.signature = [];
geoOps.RandomLine.updatePosition = function(el) {
    el.homog = List.realVector([Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5]);
    el.homog = List.normalizeMax(el.homog);
    el.homog = General.withUsage(el.homog, "Line");
};


geoOps.FreeLine = {};
geoOps.FreeLine.kind = "L";
geoOps.FreeLine.signature = [];
geoOps.FreeLine.isMovable = true;
geoOps.FreeLine.initialize = function(el) {
    var pos = geoOps._helper.initializeLine(el);
    putStateComplexVector(pos);
};
geoOps.FreeLine.getParamForInput = function(el, pos, type) {
    var homog;
    if (type === "mouse") {
        homog = List.cross(pos, List.ez);
        homog = List.cross(homog, pos);
    } else if (type === "homog") {
        homog = pos;
    } else {
        homog = List.turnIntoCSList([CSNumber.zero, CSNumber.zero, CSNumber.zero]);
    }
    return List.normalizeMax(homog);
};
geoOps.FreeLine.getParamFromState = function(el) {
    return getStateComplexVector(3);
};
geoOps.FreeLine.putParamToState = function(el, param) {
    putStateComplexVector(param);
};
geoOps.FreeLine.updatePosition = function(el) {
    var param = getStateComplexVector(3);
    putStateComplexVector(param); // copy param
    el.homog = General.withUsage(param, "Line");
};
geoOps.FreeLine.getRandomMove = function(el) {
    var rcomplex = function() {
        var fact = 0.1;
        // only real for debugging REMOVE later
        return CSNumber.complex((Math.random() - 0.5) * fact, (Math.random() - 0.5) * 0);
    };
    var l = el.homog;
    var tt = List.turnIntoCSList([l.value[0], l.value[1], CSNumber.zero]);
    var p = List.turnIntoCSList([rcomplex(), rcomplex(), CSNumber.real(1)]);
    var perp = List.cross(p, tt);

    var move = List.cross(perp, l);
    move = List.normalizeMax(move);

    return {
        type: "mouse",
        value: move
    };

};
geoOps.FreeLine.stateSize = 6;


geoOps.RandomPoint = {};
geoOps.RandomPoint.kind = "P";
geoOps.RandomPoint.signature = [];
geoOps.RandomPoint.updatePosition = function(el) {
    el.homog = List.realVector([100 * Math.random(), 100 * Math.random(), 100 * Math.random()]);
    el.homog = List.normalizeMax(el.homog);
    el.homog = General.withUsage(el.homog, "Point");
};
{'fraction_non_alphanumeric': 0.15767559739319334, 'fraction_numerical': 0.010137581462708182, 'mean_word_length': 3.286268425135764, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1744697', 'n_tokens_mistral': 1921, 'n_tokens_neox': 1866, 'n_words': 398}