working on it ...

Filters

Explore Public Snippets

Sort by

Found 3,697 snippets matching: xyz

    public by lbottaro  4524  5  7  5

    How to sort a Javascript array parsing elements using regex pattern

    The Javascript Array.sort() method accepts a callback function to compare two elements of the array using a specific logic. The callback function below may help you in sorting an array matching a particular regular expression pattern. The format of elements in array is x/y/z, where x, y and z are integers, eg "5/10/2". I need to sort the eleme
    var myCompare = function(a,b) {
    	var matchPattern_A = /^([0-9]+)\/([0-9]+)\/([0-9]+)$/g.exec(a);
    	var matchPattern_B = /^([0-9]+)\/([0-9]+)\/([0-9]+)$/g.exec(b);
    
    	if(matchPattern_A && matchPattern_B)
    	{
    		//Apply regex sort
    		//I need to sort based on match[1], match[2], match[3]
    		console.log('Apply regex sort');
    
    		if (parseInt(matchPattern_A[1], 10) < parseInt(matchPattern_B[1], 10))
    			return -1;
    		if (parseInt(matchPattern_A[1], 10) > parseInt(matchPattern_B[1], 10))
    			return 1;
    		else {
    			if (parseInt(matchPattern_A[2], 10) < parseInt(matchPattern_B[2], 10))
    				return -1;
    			if (parseInt(matchPattern_A[2], 10) > parseInt(matchPattern_B[2], 10))
    				return 1;
    			else {
    				if (parseInt(matchPattern_A[3], 10) < parseInt(matchPattern_B[3], 10))
    					return -1;
    				if (parseInt(matchPattern_A[3], 10) > parseInt(matchPattern_B[3], 10))
    					return 1;
    				return 0;
    			}
    		}
    	}
    	else {
    		//Apply basic lexicographic sort
    		console.log('Apply basic lexicographic sort');
    		if (a < b)
    			return -1;
    		if (a > b)
    			return 1;
    		return 0;
    	}
    };
    
    var myArr = [ '5/4/30', '5/10/2', '5/4/3', '1/3/8'];
    console.log(myArr);
    myArr.sort(this.myCompare);
    console.log(myArr);
    
    /*  Example,
        having an array as
        ['5/4/30', '5/10/2', '5/4/3', '1/3/8']
        it will be sorted as
        ['1/3/8', '5/4/3', '5/4/30', '5/10/2']
    */            

    external by brendanashj  3  0  1  0

    So XYZ Collagen Cream accompanies regular herbs answer for keep skin free from any skin issues when you cross 30s.Click here https://healthsupplementzone.com/xyz-collagen-cream/

    So XYZ Collagen Cream accompanies regular herbs answer for keep skin free from any skin issues when you cross 30s.Click here https://healthsupplementzone.com/xyz-collagen-cream/: XYZ Collagen Cream
    So XYZ Collagen Cream accompanies regular herbs answer for keep skin free from any skin issues when you cross 30s.Click here https://healthsupplementzone.com/xyz-collagen-cream/
    
    

    external by Daniel  114  0  2  0

    Gameobject XYZ to Area and Zone

    Gameobject XYZ to Area and Zone: gistfile1.txt
    void ObjectMgr::WriteGameObjectTextFile()
    {
        bool stop = false;
        if (stop)
            return;
    
        std::ofstream myfile;
        myfile.open("gameobjects.txt");
    
        for (uint32 i = 1; i < mGameObjectDataMap.size(); i++)
        {
            if (mGameObjectDataMap.find(i) == mGameObjectDataMap.end())
                continue;
    
            GameObjectData& go = mGameObjectDataMap.at(i);
            
            const GameObjectInfo* info = GetGameObjectInfo(go.id);
    
            if (info->type != GAMEOBJECT_TYPE_CHEST)
                continue;
    
            uint32 zone_id = sTerrainMgr.GetZoneId(go.mapid, go.posX, go.posY, go.posZ);
            uint32 area_id = sTerrainMgr.GetAreaId(go.mapid, go.posX, go.posY, go.posZ);
            
            AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zone_id);
            AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(area_id);
    
            myfile << "Gameobject GUID: " << i << "; ID: " << go.id << " Name: " << info->name << " ; XPos: " << go.posX << " ; YPos: " << go.posY << " ; ZPos: " << go.posZ << " ; Zone: " << zone_id << "; " << zoneEntry->area_name[3] << " ; Area: " << area_id << "; " << areaEntry->area_name[3] << "\n";
            
        }
        myfile.close();
    
    }
    
    
    

    external by Github  573  0  3  0

    http://streamsoccer.xyz/watch-houston-rockets-utah-jazz-live-stream-29-11-2016/

    http://streamsoccer.xyz/watch-houston-rockets-utah-jazz-live-stream-29-11-2016/: gistfile1.txt
    http://streamsoccer.xyz/watch-houston-rockets-utah-jazz-live-stream-29-11-2016/
    
    

    external by mario52a  34  0  1  0

    This small macro create a line giving as an argument the XYZ coordinates, length, and angle

    This small macro create a line giving as an argument the XYZ coordinates, length, and angle : Macro_Line_Length.FCMacro
    # -*- coding: utf-8 -*-
    # créer une ligne avec une coordonnée une longueur et un angle sur le plan X Y
    # create line with coordinate length and angle to plane X Y
    import FreeCAD, FreeCADGui, Draft
    from math import cos, sin, radians
    #from FreeCAD import Base
     
    def line_length(x1 = 0.0, y1 = 0.0, z1 = 0.0, length = 10.0, angle = 0.0):
        x2 = x1 + (length * cos(radians(angle)))
        y2 = y1 + (length * sin(radians(angle)))
        z2 = z1 #+ ()
        Draft.makeWire([FreeCAD.Vector(x1,y1,z1),FreeCAD.Vector(x2,y2,z2)])
     
    x1 = 0.0          # Edit coordinate x1 origin
    y1 = 0.0          # Edit coordinate y1 origin
    z1 = 0.0          # Edit coordinate z1 origin
    length = 50.0       # Edit length
    angle  = 45.0       # Edit angle plane XY
     
    #line_length(x1, y1, z1, length, angle)
    
    
    

    external by Github  196  13  2  0

    City Hunter Sound Collection XYZ OSTAnimeSlurpnetMP3320Kbps 95

    City Hunter Sound Collection XYZ OSTAnimeSlurpnetMP3320Kbps 95: gistfile1.txt
    
    ********************
    City Hunter Sound Collection XYZ - [OST][AnimeSlurp.net][MP3-320Kbps] 95 ->->->->
    ********************
    http://shurll.com/cwlpd
    (Copy & Paste link)
    ********************
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    Scaricare City hunter - Torrent iTalian
    City Hunter Sound Collection XYZ - [OST][AnimeSlurp.net][MP3-320Kbps] Musica : 507.41 MB : City Hunter Vol.15-28 .. City Hunter S01-04e001-140 Special 01-06 .
    https://itorrento.com/city+hunter.html
    
    City Hunter Sound Collection XYZ [OST] Download
    monova.org City Hunter Sound Collection XYZ - [OST][AnimeSlurp.net][MP3-320Kbps] .. eu City Hunter Sound Collection XYZ - [OST .. City Hunter Sound Collection Y .
    https://torrentz2.eu/76dd154d90ca13b55fe169d01ca3b9d2e5ac516a
    
    Firearms and Hunting
    Download City Hunter Sound Collection XYZ - [OST][AnimeSlurp.net][MP3-320Kbps] torrent .Bit Torrent Scene ( BTScene ) a public file sharing platform.
    https://bt-scene.cc/city-hunter-sound-collection-xyz-tf746085.html
    
    Drama Of Fiji: A Contemporary History Download.zip.. Grupo .
    .. Stalin's War on Ukraine downloads torrent modern abc of biology class 12 pdf free download City Hunter Sound Collection XYZ - [OST][AnimeSlurp.net] .
    https://sappmonnemyrac.jimdo.com/2017/11/12/drama-of-fiji-a...
    
    ilCorSaRoNeRo.info - just Torrent iTALiANi - anime ita torrent
    * Ultimi Torrent Cambiate i DNS con .. [OST][AnimeSlurp.net][mp3-320kbps] 220.35 MB: .. City Hunter Sound Collection XYZ - [OST] .
    https://ilcorsaronero.info/torrent-ita/2/anime.html
    
    Scaricare City Hunter Sound Collection XYZ[OST][AnimeSlurp .
    Titolo: City Hunter Sound Collection XYZ - [OST][AnimeSlurp.net][MP3 Categoria: Musica Dimensione: 507.41 MB Hash: 76dd154d90ca13b55fe169d01ca3b9d2e5ac516a
    https://itorrentoz.eu/torrent/76dd154d90ca13b55fe169d01ca3b9d2e5ac516a
    
    My Name Is Khan Bangla Movie All Mp3 Song Downloadinstmank .
    .. 2007 dvdrip 300 mb movies download City Hunter Sound Collection XYZ - [OST] .. download City Hunter Sound Collection XYZ - [OST][AnimeSlurp.net][MP3-320Kbps] .
    https://cranunscalatmo.jimdo.com/2017/06/06/my-name-is-khan-bangla...
    
    City Hunter Sound Collection XYZ - [OST][AnimeSlurp.net .
    To The Future (MP3 320kbps) .. City Hunter Sound Collection X,Y,Z [FLAC .. [Album] .Download City Hunter Sound Collection XYZ - [OST][AnimeSlurp.net][MP3-320Kbps] .
    https://bascuduhehol.jimdo.com/2017/11/09/city-hunter-sound...
    
    City Hunter Sound Collection XYZ - [OST][AnimeSlurp.net .
    City Hunter Sound Collection XYZ - [OST][AnimeSlurp.net][MP3-320Kbps]
    https://ilcorsaronero.info/tor/29702/City_Hunter_Sound_Collection...
    
    City Hunter Sound Collection Xyz Zip :: geriroti
    City Hunter Sound Collection Xyz Zip City Hunter Sound Collection Xyz Zip .. [Album] .Download City Hunter Sound Collection XYZ - [OST][AnimeSlurp.net][MP3-320Kbps] .
    geriroti.niloblog.com/p/24/City Hunter Sound Collection Xyz Zip.  7286bcadf1 
    
    

    external by perrygeo  11  0  1  0

    Calculate size of pixel on a mercator xyz tile

    Calculate size of pixel on a mercator xyz tile: tile_pixel_size.py
    import math
    
    def pixel_size(z, lat, circ=40075160):
        """
        Returns the size of a pixel (units same as circumference)
    
        Parameters: 
          z: zoom level
          lat: latitude in degrees
          circ: circumference (default = 40075160 meters)
    
        Notes:
          spheroid calculation may be off slightly from true ellipsoid
        """
        return circ * math.cos(math.radians(lat)) / (2 ** (z + 8))
    
    if __name__ == "__main__":
        assert round(pixel_size(z=5, lat=0)) == 4892
        assert round(pixel_size(z=5, lat=45)) == 3459
    
    

    external by peter-stratton  11  0  1  0

    XYZ coordinate distance calculation

    XYZ coordinate distance calculation: xyzDistCalc.py
    import math
    
    x1,y1,z1 = 5.0,6.7,1.5
    x2,y2,z2 = 4.0,1.2,1.6
    distance = math.sqrt((x2-x1)**2+(y2-y1)**2+(z2 -z1)**2)
    
    

    external by Manohar Kuse  321  6  3  0

    Convert GPS (Latitude and Longitude) to XYZ

    Convert GPS (Latitude and Longitude) to XYZ : lat_long_2_XYZ.py
    """ Convert GPS (Latitude and Longitude) to XYZ wrt a set Lat Long as origin """
    
    def geodedic_to_ecef( lati, longi, alti ):
        """ lati in degrees, longi in degrees. alti in meters (mean sea level) """
        # Adopted from https://en.wikipedia.org/wiki/Geographic_coordinate_conversion#From_geodetic_to_ECEF_coordinates
        phi = lati / 180. * np.pi
        lambada = longi / 180. * np.pi
        h = alti
    
        #N = 6371000 #in meters
        e = 0.081819191 #earth ecentricity
        q = np.sin( phi )
        N = 6378137.0 / np.sqrt( 1 - e*e * q*q )
        X = (N + h) * np.cos( phi ) * np.cos( lambada )
        Y = (N + h) * np.cos( phi ) * np.sin( lambada )
        Z = (N*(1-e*e) + h) * np.sin( phi )
    
        return X,Y,Z
    
    def compute_ecef_to_enu_transform( lati_r, longi_r ):
        """ Computes a matrix_3x3 which transforms a ecef diff-point to ENU (East-North-Up)
            Needs as input the latitude and longitude (in degrees) of the reference point
        """
        # Adopted from https://en.wikipedia.org/wiki/Geographic_coordinate_conversion#From_ECEF_to_ENU
    
        phi = lati_r / 180. * np.pi
        lambada = longi_r / 180. * np.pi
    
        cp = np.cos( phi ) #cos(phi)
        sp = np.sin( phi ) #cos(phi)
        cl = np.cos( lambada )
        sl = np.sin( lambada )
    
        T = np.zeros( (3,3), dtype='float64' )
        T[0,0] = -sl
        T[0,1] = cl
        T[0,2] = 0
    
        T[1,0] = -sp * cl
        T[1,1] = -sp * sl
        T[1,2] = cp
    
        T[2,0] = cp * cl
        T[2,1] = cp * sl
        T[2,2] = sp
    
        T_enu_ecef = T
        return T_enu_ecef
    
      
    # GPS (geodedic to Earth-center cords, ie. ecef )
    Xr, Yr, Zr = geodedic_to_ecef( 22.3349060891, 114.263170818, 173.073608398 ) #of radar
    T_enu_ecef = compute_ecef_to_enu_transform( 22.3349060891, 114.263170818 )
    
    Xp, Yp, Zp = geodedic_to_ecef( data.latitude, data.longitude, data.altitude ) #curr pos of drone
    
    #
    # ECEF to ENU (East-North-Up)
    delta = np.array( [Xp-Xr, Yp-Yr, Zp-Zr] )
    
    

    external by Thomas Mansencal  336  1  3  0

    ACES - XYZ Matrices

    ACES - XYZ Matrices: aces_xyz_matrices.ipynb
    {
     "cells": [
      {
       "cell_type": "code",
       "execution_count": 1,
       "metadata": {
        "collapsed": false
       },
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": [
          "Rec. 709\n",
          "[[ 3.24100326 -1.53739899 -0.49861587]\n",
          " [-0.96922426  1.87592999  0.04155422]\n",
          " [ 0.05563942 -0.2040112   1.05714897]]\n",
          "[[ 3.20976213 -1.55756431 -0.4958272 ]\n",
          " [-0.97097971  1.88516233  0.03948918]\n",
          " [ 0.05972118 -0.21010871  1.14312725]]\n",
          "\n",
          "\n",
          "DCI-P3\n",
          "[[ 2.72539403 -1.01800301 -0.4401632 ]\n",
          " [-0.79516803  1.68973205  0.02264719]\n",
          " [ 0.04124189 -0.08763902  1.10092938]]\n",
          "[[ 2.66286214 -1.11031817 -0.42271645]\n",
          " [-0.82282389  1.75861719  0.02502194]\n",
          " [ 0.03932559 -0.08383443  1.03721743]]\n",
          "\n",
          "\n",
          "Rec. 2020\n",
          "[[ 1.71666343 -0.35567332 -0.25336809]\n",
          " [-0.66667384  1.61645574  0.0157683 ]\n",
          " [ 0.01764248 -0.04277698  0.94224328]]\n",
          "[[ 1.69666139 -0.36554901 -0.24857509]\n",
          " [-0.67040031  1.62348268  0.01503882]\n",
          " [ 0.02063133 -0.04775565  1.01910748]]\n"
         ]
        }
       ],
       "source": [
        "import numpy as np\n",
        "import colour\n",
        "\n",
        "print('Rec. 709')\n",
        "print(np.linalg.inv(colour.RGB_COLOURSPACES['Rec. 709'].RGB_to_XYZ_matrix))\n",
        "\n",
        "D60 = colour.ILLUMINANTS['cie_2_1931']['D60']\n",
        "D65 = colour.ILLUMINANTS['cie_2_1931']['D65']\n",
        "M = colour.chromatic_adaptation_matrix_VonKries(\n",
        "    colour.xyY_to_XYZ(colour.xy_to_xyY(D60)),\n",
        "    colour.xyY_to_XYZ(colour.xy_to_xyY(D65)),\n",
        "    transform='Bradford')\n",
        "\n",
        "print(np.linalg.inv(colour.dot_matrix(np.linalg.inv(M),\n",
        "                                      colour.RGB_COLOURSPACES['Rec. 709'].RGB_to_XYZ_matrix)))\n",
        "\n",
        "print('\\n')\n",
        "\n",
        "print('DCI-P3')\n",
        "print(np.linalg.inv(colour.RGB_COLOURSPACES['DCI-P3'].RGB_to_XYZ_matrix))\n",
        "\n",
        "D60 = colour.ILLUMINANTS['cie_2_1931']['D60']\n",
        "P3 = colour.ILLUMINANTS['cie_2_1931']['DCI-P3']\n",
        "M = colour.chromatic_adaptation_matrix_VonKries(\n",
        "    colour.xyY_to_XYZ(colour.xy_to_xyY(D60)),\n",
        "    colour.xyY_to_XYZ(colour.xy_to_xyY(P3)),\n",
        "    transform='Bradford')\n",
        "\n",
        "print(np.linalg.inv(colour.dot_matrix(np.linalg.inv(M),\n",
        "                                      colour.RGB_COLOURSPACES['DCI-P3'].RGB_to_XYZ_matrix)))\n",
        "\n",
        "print('\\n')\n",
        "\n",
        "print('Rec. 2020')\n",
        "print(np.linalg.inv(colour.RGB_COLOURSPACES['Rec. 2020'].RGB_to_XYZ_matrix))\n",
        "M = colour.chromatic_adaptation_matrix_VonKries(\n",
        "    colour.xyY_to_XYZ(colour.xy_to_xyY(D60)),\n",
        "    colour.xyY_to_XYZ(colour.xy_to_xyY(D65)),\n",
        "    transform='Bradford')\n",
        "\n",
        "print(np.linalg.inv(colour.dot_matrix(np.linalg.inv(M),\n",
        "                                      colour.RGB_COLOURSPACES['Rec. 2020'].RGB_to_XYZ_matrix)))\n"
       ]
      }
     ],
     "metadata": {
      "kernelspec": {
       "display_name": "Python 2",
       "language": "python",
       "name": "python2"
      },
      "language_info": {
       "codemirror_mode": {
        "name": "ipython",
        "version": 2
       },
       "file_extension": ".py",
       "mimetype": "text/x-python",
       "name": "python",
       "nbconvert_exporter": "python",
       "pygments_lexer": "ipython2",
       "version": "2.7.10"
      }
     },
     "nbformat": 4,
     "nbformat_minor": 0
    }
    
    
    
    • Public Snippets
    • Channels Snippets