Monday, December 11, 2023

One Frame Animation

SkeletalMesh->PlayAnimation(MyAnim, false);
SkeletalMesh->bPauseAnims = true;
UAnimSingleNodeInstance* Inst = Cast<UAnimSingleNodeInstance>(AnimInstance);
if ( Inst )
{
    Inst->SetPosition(AnimTime);
}

Wednesday, November 22, 2023

Compile MD5 using openssl on linux

 cc digestMD5.c -o digestMd5 -L/usr/openssl/lib64 -lssl -lcrypto -ldl


I installed openssl into /usr/openssl


Or openssl is located in /opt/openssl

Wednesday, September 13, 2023

Baseball terms

심판 - Umpire


투수 - Pitcher


포수 - Catcher


타자 - Batter


지명타자 - Designated hitter


1루수 - First baseman


2루수 - Second baseman


3루수 - Third baseman


유격수 - Shortstop


좌익수 - Left fielder


중견수 - Center fielder


우익수 - Right fielder


중간계투/구원투수 - Bullpen pitcher


마무리투수 - Closer


주자 - Runner



눈치채셨겠지만


1루는 First base


2루는 Second base


3루는 Third base 입니다.




공을던지다 - Pitch the ball


공을 치다 - Hit the ball


파울 - foul ball


1루타 - single


2루타 - double


3루타 - triple


내야안타 - infield hit


홈런 - homerun


만루홈런 - grand slam


도루 - Stolen base


볼넷 - base on balls


삼진 - Strike out


직구 - Fast ball


변화구 - Breaking ball


내야 땅볼 - Ground out


직선타구 - Line drive


뜬공 - Fly ball


견제구 - Pick-off throw


땅볼 - Ground ball


Thursday, August 24, 2023

Collision detection : Circle vs Rectangle

detection only


int CheckHit( F_RECT *prcRect1, F_CIRCLE *pcrCircle2 )

{

    int             nResult = false;

    float           ar;


    if ( ( pcrCircle2->x > prcRect1->fLeft   - pcrCircle2->r ) &&

         ( pcrCircle2->x < prcRect1->fRight  + pcrCircle2->r ) &&

         ( pcrCircle2->y > prcRect1->fTop    - pcrCircle2->r ) &&

         ( pcrCircle2->y < prcRect1->fBottom + pcrCircle2->r ) )

    {

        nResult = true;

        ar = pcrCircle2->r;

        if ( pcrCircle2->x < prcRect1->fLeft ) {

            if ( ( pcrCircle2->y < prcRect1->fTop ) )

            {

                if ( ( DistanceSqr( prcRect1->fLeft,  prcRect1->fTop,

                                    pcrCircle2->x, pcrCircle2->y ) >= ar * ar ) ) {

                    nResult = false;

                }

            }

            else {

                if ( ( pcrCircle2->y > prcRect1->fBottom ) )

                {

                    if ( ( DistanceSqr( prcRect1->fLeft,  prcRect1->fBottom,

                                        pcrCircle2->x, pcrCircle2->y ) >= ar * ar ) ) {

                        nResult = false;

                    }

                }

            }

        }

        else {

            if ( pcrCircle2->x > prcRect1->fRight ) {

                if ( ( pcrCircle2->y < prcRect1->fTop ) )

                {

                    if ( ( DistanceSqr( prcRect1->fRight,  prcRect1->fTop,

                                        pcrCircle2->x, pcrCircle2->y ) >= ar * ar ) ) {

                        nResult = false;

                    }

                }

                else {

                    if ( ( pcrCircle2->y > prcRect1->fBottom ) )

                    {

                        if ( ( DistanceSqr( prcRect1->fRight,  prcRect1->fBottom,

                                            pcrCircle2->x, pcrCircle2->y ) >= ar * ar ) ) {

                            nResult = false;

                        }

                    }

                }

            }

        }

    }

    return nResult;

}

Wednesday, August 9, 2023

대화의 격률

 https://ko.wikipedia.org/wiki/%EA%B7%B8%EB%9D%BC%EC%9D%B4%EC%8A%A4%EC%9D%98_%EB%8C%80%ED%99%94%EA%B2%A9%EB%A5%A0

Monday, July 31, 2023

Unreal Engine's DrawDebugCone

There are two versions of implementation of DrawDebugCone.

One it takes two angles in radians and other one takes degrees. OTL

Tuesday, July 11, 2023

Order of mov (assembler)

mov ax, 3


which mean move a number 3 into ax register. This is an intel assembler order.


Other assembler use opposite order for instance


mov 3, ax


which is exactly same meanning like shown above.


Monday, July 10, 2023

three types of locks

 1. Try lock

try it only once


2. Spin lock

try forever until it acquires the lock


3. Timeout lock

try it for up to some period of time

Wednesday, July 5, 2023

Thursday, June 29, 2023

implement add with + operator with racket

 #lang racket


; implement add without + operator


(define add

  (λ (n m)

    (cond

      ((zero? m) n)

      (else (add1

            (add n (sub1

                    m)))))))


One thing I want to notice is that add1 and sub1 are not what I defined myself.

racket basic

 #lang racket


; define a constant

(define myval 3.14)


; function without param

(define myfunc

  (λ ()

    (+ 3 4)))


; call function

(myfunc)


; function with param(which is one formal)

(define myfunc-mul-two

  (λ (x)

    (* 2 x)))


(myfunc-mul-two 4)


; outer function calls inner function

(define double-result-of-f

  (λ (f)

    (λ (z)

      (* 2 (f z)))))


(define add3

  (λ (x)

    (+ 3 x)))


((double-result-of-f add3) 4)


Thursday, June 22, 2023

binary search alternative

#include <iostream>

#include <vector>


using namespace std;


int main()

{

    int array[] = { 1,3,3,4,5,5,6,9,10,12,12,15 };

    int n = sizeof(array) / sizeof(int);

    int k = 0;

    int x = 3;


    for (int b = n / 2; b >= 1; b /= 2)

    {

        while (k + b < n && array[k + b] <= x)

        {

            k += b;

        }

    }

    

    if (array[k] == x)

    {

        int a = 10;

    }

}


remainder in racket

 #lang racket


(define remainder

  (λ (x y)

    (cond

      ((< x y) x)

      (else (remainder (- x y) y)))))

Wednesday, June 21, 2023

unix tree

minnie.tuhs.org/cgi-bin/utree.pl

which on linux

which is used to locate a command. which returns the pathnames of the files (or links) which would be executed in the current environment, had its arguments been given as commands in a strictly POSIX-conformant shell. It does this by searching the PATH for executable files matching the names of the arguments. It does not follow symbolic links.

Wednesday, June 14, 2023

stdc++

#include <bits/stdc++.h>
using namespace std;
int main()
{
}

stdc++.h allows us to include the entire standard library so I don't need to include each separate header files such as vector, iostream, algorithm and so on.

but it is only for competitive programming not for a professional developer.

use gdbm on ubuntu

First thing you have to do is checking whether gdbm is installed on your system or not.

normally it is installed on /usr/include


find /usr/include *dbm* is the command you can use.


even though gdbm is installed on your machine, you might need to install gdbm_compat if you use ndbm interface.


sudo apt-get install apt-file

apt-file update

apt-file search ndbm.h


then you will see packages that you should install on your machine.


Tuesday, June 6, 2023

안다는 것

子曰 由, 誨女知之乎. 知之爲知之, 不之爲不知, 是知也

Sunday, June 4, 2023

List symbols from object file on linux

 


search all of the symbols in a program. if you can see any of functions beginning of aio_ then for sure it uses async I/O.

Sunday, May 28, 2023

curses on linux

 


in case of you have no curses library installed, use 


sudo apt-get install libncurses5-dev


and then compile source code like down below.


cc -o sizeterm sizeterm.c -lncurses


Tuesday, May 23, 2023

Linux : find

 find /usr/bin -name "ch*"


not like find/usr/bin -name ch*



// search a file based on the size.

find . -size -600c -ls  // less than 600bytes

find . -size +600c -ls // greater than 600bytes

find . -size 600c -ls // 600 bytes


b -> block

c -> bytes

k -> killo

w -> word



Monday, May 15, 2023

Performance Mantras

Don't do it.
Do it, but don't do it again.
Do it less.
Do it later.
Do it when they're not looking.
Do it concurrently.
Do it more cheaply.

Thursday, May 11, 2023

Wednesday, May 10, 2023

BloomFilter

Note : BloomFilter in this article is not about rendering filter


False Positive

https://terms.naver.com/entry.naver?docId=862393&cid=50371&categoryId=50371


Good Articles

https://brilliant.org/wiki/bloom-filter/

https://www.youtube.com/watch?v=V3pzxngeLqw

https://llimllib.github.io/bloomfilter-tutorial/




Sorted String Table : SStable

 https://www.igvita.com/2012/02/06/sstable-and-log-structured-storage-leveldb/

Tuesday, May 9, 2023

Linux shell programming

 - without permission change

/bin/sh <name of script>


- make scrhipt to be an excutable file

chmod +x <name of script>

Saturday, May 6, 2023

Rendering : Glossary


• OpenGL: a formal specification of a graphics API that defines the layout and output of each function.

• GLAD: an extension loading library that loads and sets all OpenGL’s function pointers for us so we can use all (modern) OpenGL’s functions.

• Viewport: the 2D window region where we render to.

• Graphics Pipeline: the entire process vertices have to walk through before ending up

as one or more pixels on the screen.

• Shader: a small program that runs on the graphics card. Several stages of the graphics

pipeline can use user-made shaders to replace existing functionality.

• Vertex: a collection of data that represent a single point.

• Normalized Device Coordinates: the coordinate system your vertices end up in

after perspective division is performed on clip coordinates. All vertex positions in NDC

between -1.0 and 1.0 will not be discarded or clipped and end up visible.

• Vertex Buffer Object: a buffer object that allocates memory on the GPU and stores

all the vertex data there for the graphics card to use.

• Vertex Array Object: stores buffer and vertex attribute state information.

• Element Buffer Object: a buffer object that stores indices on the GPU for indexed

drawing.

• Uniform: a special type of GLSL variable that is global (each shader in a shader program

can access this uniform variable) and only has to be set once.

• Texture: a special type of image used in shaders and usually wrapped around objects,

giving the illusion an object is extremely detailed.

• Texture Wrapping: defines the mode that specifies how OpenGL should sample textures

when texture coordinates are outside the range: (0, 1).

• Texture Filtering: defines the mode that specifies how OpenGL should sample the

texture when there are several texels (texture pixels) to choose from. This usually occurs

when a texture is magnified.

• Mipmaps: stored smaller versions of a texture where the appropriate sized version is chosen based on the distance to the viewer.

• stb_image: image loading library.

• Texture Units: allows for multiple textures on a single shader program by binding

multiple textures, each to a different texture unit.

• Vector: a mathematical entity that defines directions and/or positions in any dimension.

• Matrix: a rectangular array of mathematical expressions with useful transformation properties.

• GLM: a mathematics library tailored for OpenGL.

• Local Space: the space an object begins in. All coordinates relative to an object’s origin.

• World Space: all coordinates relative to a global origin.

• View Space: all coordinates as viewed from a camera’s perspective.

• Clip Space: all coordinates as viewed from the camera’s perspective but with projection

applied. This is the space the vertex coordinates should end up in, as output of the vertex

108 Chapter 11. Review shader. OpenGL does the rest (clipping/perspective division).

• Screen Space: all coordinates as viewed from the screen. Coordinates range from 0 to

screen width/height.

• LookAt: a special type of view matrix that creates a coordinate system where all coordinates are rotated and translated in such a way that the user is looking at a given target from a given position.

• Euler Angles: defined as yaw, pitch and roll that allow us to form any 3D direction

vector from these 3 values.

Task in UnrealEngine

 https://www.youtube.com/watch?v=1lBadANnJaw