Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix calculation of E_P to handle 3+ devices #68

Open
mccoykillian opened this issue Jan 19, 2018 · 0 comments
Open

Fix calculation of E_P to handle 3+ devices #68

mccoykillian opened this issue Jan 19, 2018 · 0 comments
Assignees

Comments

@mccoykillian
Copy link
Member

mccoykillian commented Jan 19, 2018

Currently, E_P calculations are only supported for two devices. In order to send responses to more than two devices, distinct calculations must be sent upon individual recipient broadcast. Therefore this issue cannot be completed until issue #66 is addressed.

When broadcasting distinct responses to each recipient becomes possible, the below psuedocode should make sure that the correct event placement is being broadcast to each type of device registered with the server:

when building response messages:

	event //unconverted event coordinates that may be recalculated twice depending on a particular broadcast's sender and recipient's roles
	var e_l //obtain event in primary device's coordinates (first potential calcuation)
	var e_p //obtain event in secondary device's coordinates (second potential calcuation)

	if sender is a secondary device  {  //establish primary perspective

		//calculate object in primary device's coordinates
			find primary device
			e_l = getE_L(sender, primaryDevice, event)

	} else { //sender is primary device & already in perspective
		e_l = event
	}

	//transform and/or broadcast primary device's event 
	for the list of recipient devices
		if recipient != primaryDevice && sender != recipient {
			e_p = getE_P(recipient, e_l)
			//calculate e_p from primary to secondary device
				//e_p = e_l - o_p
					//where o_p = t_p - t_l
		} else { //device == primary device || self to self broadcast
			e_p = e_l
		}
		broadcast e_p as the offset in the response for this recipient device

The existing getE_P function will probably need to be separated into getE_L (get event coordinates local to the primary device) and getE_P (get event coordinates relative to the target device) for the two different stages of calculations as seen above. The beginning work of this can be found in the handle3PlusDevices branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants