## How to rotate points on spherical cap with specific theta and phi?

I generate N=1000 points in spherical cap {rho = 10, 0 deg<theta<30 deg, 0<phi<2pi} as shown in the figure below. And now I want to rotate these points together such that the center of the cap goes to the specific theta and phi with the distances to other points unchanged. For example, if we move the center of the cap from (theta=0, phi=0) to (theta=90 deg, phi=90 deg), the cap should be shown as I first try to add the specific theta and phi to the positions of all points, but with the spherical coordinates, it doesn’t work as shown in the figure below. (It becomes a ring T_T) Any one can help me to rotate all points together to such that the center of the cap goes to the specific theta and phi with the distances to other points unchanged. Or please give me some advice. Thanks in advance.

Here’s my code in python

from math import * import numpy as np  def polarToxyz(polar_cord):  # theta, phi radian     r = polar_cord     theta = polar_cord     phi = polar_cord     return [r * sin(theta) * cos(phi), r * sin(theta) * sin(phi), r * cos(theta)]  theta_prime_deg = 30 theta_prime_rad = theta_prime_deg * np.pi / 180  delta_theta_deg = 0 delta_theta_rad = delta_theta_deg * np.pi / 180  delta_phi_deg = 0 delta_phi_rad = delta_phi_deg * np.pi / 180  list_x = [] list_y = [] list_z = [] for i in range(numbPoints):     rho = 10     phi = 2 * np.pi * np.random.uniform(0,1)     theta = acos(1 - np.random.uniform(0,1)*(1-cos(theta_prime_rad)))      theta += delta_theta_rad     phi += delta_phi_rad      [x,y,z] = polarToxyz([rho, theta, phi])     list_x.append(x)     list_y.append(y)     list_z.append(z)  drawFig3D(list_x, list_y, list_z) 
Posted on Categories cheapest proxies

## Line of Sight/Clear Path Check Theta* For Rectangle Character

I am implementing Theta* pathfinding in a tile-based 2D game. A tile is either blocked or unblocked. The character has a rectangle collider with a width and height in tiles. Is there an algorithm for finding all the tiles the rectangle will overlap when moving in a straight line from A to B on the tile grid?

Posted on Categories Free Proxy

## Does it make sense to say Big Theta of 1? Or should we just use Big O?

Does saying $$f(x) = \Theta(1)$$ provide any extra information than saying $$f(x) = O(1)$$?

Intuitively, nothing grows more slowly than a constant, so there should be no extra information in specifying Big Theta over Big O in this case.

## What is the Big theta of $(\log n)^2+2n+4n+\log n + 50$?

$$f(n)=(\log n)^2+2n+4n+\log n + 50$$

I am trying to mathematically prove that the $$f(n)$$ falls under the time complexity of $$\theta((\log n)^2)$$.

I need to come to the conclusion of $$f(n)\leq C(\log n)^2$$, for some positive constant $$C$$ and $$x\geq k$$.

What I have tried is:

$$(\log n)^2+\log n \leq 2(\log n)^2$$

I want to add $$6n + 50$$ to both sides, but cannot find the constant $$c$$ by algebra in $$c(\log n)^2$$.

I have just tried putting random values of $$c$$ to make $$c(\log n)^2 \geq 6n$$ true and $$c=100$$ works for $$n$$ greater than some value, but is there a mathematical way of finding this value of $$c$$ and therefore finding the big theta of this function?

Posted on Categories proxies

## Big theta of function with multiple types of n

I have the following function:

$$\displaystyle\frac{n \cdot 7^n+\frac{8}{n!}}{(n+7) \cdot 7^n}=\Theta(1)$$

I don’t how they come to this. What is the proper way to analyse a function to theta notation?

## Derive a while loop runs in $\Theta( \sqrt{n} )$

I know for a fact that algorithm A runs in $$\Theta(\sqrt{n})$$, but how does one derive that fact?

Algorithm A

i = 0 s = 0 while s <= n:     s += i     i += 1 

Here is what I am thinking. We know that A is upper-bounded by O(n), as we increment $$s$$ by more than 1 in each iteration. We also know that it must be lower-bounded by $$\log n$$, as we increment $$s$$ with by something less than $$2^i$$ in each iteration. (Correct me if I am wrong, these are just my thoughts …).

Now, what else can we say about A? How do we derive that its time complexity is $$\Theta(\sqrt{n})$$?

## How can $\Theta$ and $O$ complexities be different?

From the definition of the $$\Theta$$-notation, $$f(x)=\Theta(g(x))\\implies c_1g(x)\le f(x)\le c_2g(x), \exists n_0 \; \forall c_1,c_2\gt 0 \;\forall n\gt n_0$$

We can see that the inequality is followed for all $$n\gt n_0$$, and hence we can say that $$c_2g(x)$$ is the maximum that this function can reach. Therefore, $$f(x)=O(g(x))$$ as well.

If we take the example of quicksort, sources say that the $$\Theta$$ complexity is $$n\log{n}$$, but $$O$$-complexity is given as $$n^2$$.

If the $$O$$-complexity given is true, then $$f(x)\le c_2n\log{n}$$ will not always be true. So in this case, how is $$\Theta$$-complexity different from $$O$$-complexity?

Posted on Categories proxies

## What is the main difference between Theta star algorithm and Phi star algorithm?

I’m trying to work on Phi* algorithm for pathfinding and I’m confused about it and the Theta star. What are the new points of the Phi* algorithm and How could I deal with it? Any guidance, please?

Posted on Categories Free Proxy

## How could I match my line-of-sight with Theta star? How could I fix my below problem?

I’m trying to implement my Theta star algorithm, but first I need to implement the line-of-sight algorithm. I have implemented below my lineOFsight algorithm in Python, I don’t know how accurate it is. But when I call this function of line of sight in my program, I got the below error:

    sight = lineOfsight(elevation1,drone_height,y1,x1,y2,x2) NameError: name 'lineOfsight' is not defined 

How could I fix this error?… And Is it ture what I have coded?

My Python code below for line-of-sight Algorithm:

from Thetastar import * def lineOfsight(elevation1,drone_height,y1,x1,y2,x2):     y_size = len(elevation1)     x_size = len(elevation1)      #Distance     dy=y2-y1;     dx=x2-x1;      if dy < 0:         dy=-dy         sy=-1     else:         sy=1      if dx < 0:         dx=-dx         sx=-1     else:         sx=1      f=0     if dy >= dx:         while y1 != y2:             f = f + dx             if f>=dy and 0<y1+(sy-1)/2 and y1+(sy-1)/2<y_size and 0<x1+(sx-1)/2 and x1+(sx-1)/2<x_size:                  if elevation1(y1+(sy-1)/2,x1+(sx-1)/2)> drone_height:                      sight = 0                     return sight                 x1 = x1 + sx                 f = f - dy                 if 0<y1+(sy-1)/2 and y1+(sy-1)/2<y_size and 0<x1+(sx-1)/2 and x1+(sx-1)/2<x_size:                     if f !=0 and elevation1(y1+(sy-1)/2,x1+(sx-1)/2)> drone_height:                         sight = 0                         return sight                  if 0<y1+(sy-1)/2 and y1+(sy-1)/2<y_size and 1<x1 and x1<x_size:                            if dx==0 and elevation1(y1+(sy-1)/2,x1)>h and E(y1+(sy-1)/2,x1-1) > drone_height:                         sight=0                         return sight                  y1=y1+sy      else:         while x1 != x2:                      f=f+dy;             if f>=dx and 0<y1+(sy-1)/2 and y1+(sy-1)/2<y_size and 0<x1+(sx-1)/2 and x1+(sx-1)/2<x_size:                 if elevation1(y1+(sy-1)/2,x1+(sx-1)/2) > drone_height:                     sight=0                     return sight                 y1=y1+sy                 f=f-dx              if 0<y1+(sy-1)/2 and y1+(sy-1)/2<y_size and 0<x1+(sx-1)/2 and x1+(sx-1)/2<x_size:                 if f != 0 and elevation1(y1+(sy-1)/2,x1+(sx-1)/2) > drone_height:                     sight=0                     return sight              if 1<y1 and y1<y_size and 0<x1+(sx-1)/2 and x1+(sx-1)/2<x_size:                 if dy==0 and elevation1(y1,x1+(sx-1)/2)>h and E(y1-1,x1+(sx-1)/2)> drone_height:                     sight=0                     return sight             x1=x1+sx     sight = 1     return sight  
Posted on Categories Free Proxy

## Finding the theta notation of sum of geometric series sum

How can we prove that the sum of a geometric series sum with r>1 is of the order of the last term.

Posted on Categories proxies